Closed brackendawson closed 8 years ago
That's if an exception is thrown before the the response
variable can be set.
Whilst scanning through I also noticed this:
for i in range(len(self.send_queue)):
response = requests.post(self.server_url,
cookies={'SECRET': self.api_key},
data = json.dumps(self.send_queue[i]),
headers={'content-type': 'application/json'})
if response.status_code == requests.codes.ok:
self.send_queue.pop(i)
else:
raise EntryDatabaseException("Server returned bad status to POST:" + str(response.status_code) + " - " + str(response.text)) + " (send_queue: " + str(len(self.send_queue)) + ")"
I think the if
block should also be indented inside the for
loop?
I need to have a very close look at the send queue before I can agree there, but I expect you're right and I'd have commented if it should be outside the loop.
WRT the exception, will close this issue after reviewing all except blocks for the same. I know what it was the moment I saw the stacktrace.
On the plus side: I noticed this when a tag init'd but failed to appear in members area: The software did log the keys that locked the tag so I can erase it again. It did make it impossible for me to cheat and manually enter it in the members area by throwing away the secret. People's tag counts have fallen behind on the server but people can still get in and counts are now updating.
The disconnect seems to have been handled as designed.
The disconnect seems to have happened after a USB glitch on the Eth device that happens now and then. Afterwards the link came up but the dhcp client just wouldn't get a lease. I set kong to static IP now.
I'm writing unit tests and just spent 10 solid minutes debugging that indentation thing, that I knew I would also fix today.
Also a for loop is inappropriate due to the use of i and pop.
fixed by 464341e