Scenario: I need a few machines to process cases from a database on an NFS in SQLite and stores the results on their own local drives. Currently, I have a queue on a separate file which looks like this (the ids are just a distinct list of jobs that need to be processed):
id | status
123 | 0 (not processed)
213 | 1 (in processing)
312 | 2 (processed)
The problem with doing
BEGIN EXCLUSIVE TRANSACTION;
SELECT id FROM queue WHERE status = 0 LIMIT 1;
(application stores the id as a variable)
UPDATE queue SET status = 1 WHERE id = variable;
COMMIT;
is that the file locking on SQLite is not reliable on a network drive and it ends up locking out all machines that are trying to check the status of the queue. I have set the VBA code to retry the transaction if the database is locked after waiting for a set amount of time but this does not work due to the locking problem.
I am wondering if there is any other way to achieve this by having a centralised controller which allocates jobs and updates the queue accordingly and whether is this possible in VBA?
Thanks.
Aucun commentaire:
Enregistrer un commentaire