MCPcopy
hub / github.com/aosabook/500lines / do_sequence

Function do_sequence

cluster/code/run.py:12–36  ·  view source on GitHub ↗
(network, node, key)

Source from the content-addressed store, hash-verified

10
11sequences_running = 0
12def do_sequence(network, node, key):
13 global sequences_running
14 sequences_running += 1
15 reqs = [
16 (('get', key), None),
17 (('set', key, 10), 10),
18 (('get', key), 10),
19 (('set', key, 20), 20),
20 (('set', key, 30), 30),
21 (('get', key), 30),
22 ]
23 def request():
24 if not reqs:
25 global sequences_running
26 sequences_running -= 1
27 if not sequences_running:
28 network.stop()
29 return
30 input, exp_output = reqs.pop(0)
31 def req_done(output):
32 assert output == exp_output, "%r != %r" % (output, exp_output)
33 request()
34 Requester(node, input, req_done).start()
35
36 network.set_timer(None, 1.0, request)
37
38
39def main():

Callers 1

mainFunction · 0.85

Calls 1

set_timerMethod · 0.45

Tested by

no test coverage detected