3
Reply

Brainstorming on correct data handling on application exit or error

Charly

Charly

Nov 19 2009 6:36 AM
3.8k
Hallo all, I'm thinking about a good way to manage the execution ending of an application. The application gets data and processes for eacht row found an http request. If this fails I update a value in the db, status = 2 (error) else status = 1. Data that is fetched is updated by the stored procedure to status 9 (pending). So here I know exaclty the statues of my rows in the database when the process is done completely. Now I would like a way that when we quit the application, by ctrl-c catch or simple ":q" readline that the application quits only after the current running http request is not done (if there is one) and that this triggers an event that sets the status of this and all other data in the que back to status 0 (new). I could go the way of a thread and watches the status of a thead before doing my end event ? Any ideas ?

Answers (3)