|
26 | 26 |
|
27 | 27 | HOME = "cynic/" # Trailing slash to generate a unique home. |
28 | 28 | DEFAULT_TIMEOUT = 10.0 |
29 | | -CONSENSUS_SYNC_DELAY = 0.3 |
30 | 29 | SCOUT_PATTERN = "/>" |
31 | 30 |
|
32 | 31 | _logger = logging.getLogger("cynic") |
@@ -107,10 +106,9 @@ async def cmd_sub(node: Node, args: argparse.Namespace) -> int: |
107 | 106 | async def cmd_pub(node: Node, args: argparse.Namespace) -> int: |
108 | 107 | pubs = [node.advertise(x) for x in args.topic] |
109 | 108 | try: |
110 | | - await asyncio.sleep(CONSENSUS_SYNC_DELAY) |
111 | 109 | deadline = Instant.now() + args.timeout |
112 | 110 | message = unescape(args.data) |
113 | | - await asyncio.gather(*(pub(deadline, message, reliable=args.reliable) for pub in pubs)) |
| 111 | + await asyncio.gather(*(pub(deadline, message, reliable=True) for pub in pubs)) |
114 | 112 | _logger.info("Published on %s", args.topic) |
115 | 113 | finally: |
116 | 114 | for pub in pubs: |
@@ -147,7 +145,6 @@ async def request(pub: Publisher, timeout: float, message: bytes) -> int: |
147 | 145 | async def cmd_req(node: Node, args: argparse.Namespace) -> int: |
148 | 146 | pubs = [node.advertise(x) for x in args.topic] |
149 | 147 | try: |
150 | | - await asyncio.sleep(CONSENSUS_SYNC_DELAY) |
151 | 148 | message = unescape(args.data) |
152 | 149 | counts = await asyncio.gather(*(request(pub, args.timeout, message) for pub in pubs)) |
153 | 150 | finally: |
@@ -224,7 +221,6 @@ def main() -> int: |
224 | 221 | p_sub.set_defaults(func=cmd_sub) |
225 | 222 |
|
226 | 223 | p_pub = sub.add_parser("pub", help="publish DATA on each TOPIC once") |
227 | | - p_pub.add_argument("-r", "--reliable", action="store_true") |
228 | 224 | p_pub.add_argument("topic", nargs="+") |
229 | 225 | p_pub.add_argument("data", help=r"hex-escape-encoded, e.g. 'hello\x0dworld!\n'") |
230 | 226 | p_pub.set_defaults(func=cmd_pub) |
|
0 commit comments