File: client2.py

package info (click to toggle)
pyro5 5.16-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,124 kB
  • sloc: python: 14,328; makefile: 161; sh: 66; javascript: 62
file content (25 lines) | stat: -rw-r--r-- 893 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import time
from Pyro5.api import Proxy


with Proxy("PYRONAME:example.oneway2") as serv:
    print("incrementing a few times normally")
    serv.increment()
    serv.increment()
    serv.increment()
    counter = serv.getcount()
    print("counter in server is now: ", counter)
    print("incrementing a few times via oneway call (should be almost instantaneous)")
    serv.increment_oneway()
    serv.increment_oneway()
    serv.increment_oneway()
    counter2 = serv.getcount()
    print("counter is now: ", counter2)
    if counter2 == counter:
        print("ok, the oneway calls are still being processed in the background.")
        print("   we'll wait a bit till they're done...")
        time.sleep(2)
        counter2 = serv.getcount()
        print("counter is now: ", counter2)
    else:
        raise SystemExit("!? the oneway calls have not been processed in the background!?")