Hi all I have this part of code:
self.lock_tables("write", ['confcommands'])
self.db.execute("INSERT INTO confcommands (network_id, ntype, timestamp, command) \
VALUES (%s,%s,%s,%s)", nid, mynet_type, ts, cmdjson)
self.unlock_tables();
time.sleep(5)
como_url = "".join(['http://', options.como_address, ':', options.como_port,
'/ztc_config?netid=0&opcode_group=0&opcode=0&start=-20s&end=-1s'])
http_client = AsyncHTTPClient()
request = tornado.httpclient.HTTPRequest(url=como_url, connect_timeout=5.0, request_timeout=5.0)
response = yield tornado.gen.Task(http_client.fetch, request)
I write a command to send to a sensor into the DB. Then, I make an http request to another DB to read the response of the sensor. There's a time between the reading of the command by the sensor and its response with the elaborations.
How can I use Periodic Callback to periodically resend the request without I have to put a blocking time.sleep in my code? Help me please, I don't know where to begin...
--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.