@@ -36,7 +36,7 @@ def updating_writer(extra):
3636 """Run every so often,
3737
3838 and updates live values of the context. It should be noted
39- that there is a race condition for the update.
39+ that there is a lrace condition for the update.
4040
4141 :param arguments: The input arguments to the call
4242 """
@@ -52,7 +52,7 @@ def updating_writer(extra):
5252 context [slave_id ].setValues (register , address , values )
5353
5454
55- def run_updating_server ():
55+ async def run_updating_server ():
5656 """Run updating server."""
5757 # ----------------------------------------------------------------------- #
5858 # initialize your data store
@@ -83,11 +83,15 @@ def run_updating_server():
8383 # ----------------------------------------------------------------------- #
8484 # run the server you want
8585 # ----------------------------------------------------------------------- #
86- time = 5 # 5 seconds delay
87- loop = asyncio .get_event_loop ()
88- loop .start (time , now = False ) # initially delay by time
89- StartTcpServer (context , identity = identity , address = ("localhost" , 5020 ))
86+ log .debug ("Start server" )
87+ await StartTcpServer (
88+ context ,
89+ identity = identity ,
90+ address = ("localhost" , 5020 ),
91+ defer_start = False
92+ )
93+ log .debug ("Done" )
9094
9195
9296if __name__ == "__main__" :
93- run_updating_server ()
97+ asyncio . run ( run_updating_server () )
0 commit comments