Closed alikopasa closed 5 years ago
Hello,
With below code updateGlobalTime is updating globaltime every second. But when i request url /time in hello def globaltime is not updating.
Could anyone help me for that please?
Best Regards
from japronto import Application import sys,os,time import threading import asyncio globaltime=1 port=8080 app = Application() def updateGlobalTime(): global globaltime globaltime = int(round(time.time() * 1000)) print("globaltime",globaltime) threading.Timer(1, updateGlobalTime).start() updateGlobalTime() def hello(request): global globaltime timefromhello = int(round(time.time() * 1000)) return request.Response(json={'timefromhello': timefromhello, 'globaltime': globaltime}) app.router.add_route('/time', hello) app.run(port=port,debug=True)
HI @alikopasa I get the same problem. How can i solve this?
Hello,
With below code updateGlobalTime is updating globaltime every second. But when i request url /time in hello def globaltime is not updating.
Could anyone help me for that please?
Best Regards