Commit 067ba1ad authored by Jondy Zhao's avatar Jondy Zhao

netdrive: change sleep interval

parent c684523c
...@@ -117,12 +117,13 @@ class NetDriveUsageReporter(object): ...@@ -117,12 +117,13 @@ class NetDriveUsageReporter(object):
self.sendAllReport() self.sendAllReport()
self.initializeConnection() self.initializeConnection()
last_timestamp = datetime.now() last_timestamp = datetime.now()
interval = 30.0 if self.report_interval > 60 else (self.report_interval / 2)
try: try:
while True: while True:
current_timestamp = datetime.now() current_timestamp = datetime.now()
d = current_timestamp - last_timestamp d = current_timestamp - last_timestamp
if d.seconds < self.report_interval: if d.seconds < self.report_interval:
sleep(self.report_interval) sleep(interval)
continue continue
self.insertUsageReport(last_timestamp.isoformat(), d.seconds) self.insertUsageReport(last_timestamp.isoformat(), d.seconds)
self.sendReport() self.sendReport()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment