bearing / dosenet-raspberrypi

Raspberry Pi specific software for dosimeters.
MIT License
7 stars 21 forks source link

Fix bug in `DataHandler` for new protocol #62

Closed bplimley closed 7 years ago

bplimley commented 8 years ago

While a backlog of data is being flushed to the server in DataHandler.regular_send(), there is potential for a network error (especially if the server is receiving heavy traffic). Currently this network error is caught in DataHandler.main() but not handled correctly (cpm is saved to queue, rather than trash[0] etc.)

tybtab commented 8 years ago

Hi, Brian I'm not sure what the problem is for this specific issue. If a cpm fails to send, it will go to queue (send_to_memory method). If main undergoes a regular_send (network is up) then the queue is left-popped to a temporary trash variable which is used to send the cpm popped from the queue.

bplimley commented 7 years ago

Sorry for the delayed response. Let me just describe it more specifically with an example.

Maybe you want to use DataHandler.main() in the while loop. I haven't thought it through though.

There's also another bug here, let me make a new issue for it.

tybtab commented 7 years ago

I made some changes. When it tries to send entries in the queue now, it undergoes a try and except for each entry in the queue. If it fails, the entry is placed back in the queue and datahandler stops iterating through the queue. I also added some arguments to some of the methods in datahandler in order to implement this.

bplimley commented 7 years ago

@tybtab FYI, I tested this on my device and it looks like it works fine.