No problem at all.
The bit of magic that I forgot to tell explicitely is that db.commit() 
commits every opened transaction and starts a new one :D

just to be precise: "locking" is true currently only for sqlite engine, and 
that's because how sqlite works (it's like that also outside web2py world). 
SQLite blocks any attemp to write/read the db if there is one process 
writing to it.
Note, if your site does mostly reading, than SQLite is fine with that.
Additional note, if you're not using SQLite there are no "locks" at all.

Mysql, mssql, postgres, etc can "support" many opened transactions.....

Take it like that. Transactions are a way to provide consistent data to 
every reader/writer connected to a database. 
When you start a transaction you make sure that the changes you are making 
in that transaction get "seen" by others only when you commit it. When you 
are making updates/deletes "inside" a transaction, no-one will see those 
changes..... It's like cooking: you start with all the ingredients but you 
want to serve it when it's finished and cooked, and you don't want others 
to peek while mixing ingredients and putting it into the oven.
Before the commit, everyone will just see ingredients; after commit, 
everyone will see the cooked "version".

Again with the metaphore, with all the dbs a lot of people can concurrently 
see the ingredients (also when you started mixing and cooking) with no 
locks whatsoever. They just see the "version" the database saved with the 
last commit.

SQLite instead "refuses" to provide that feature (currently there is a way, 
but it's far from this discussion) and allows no-one to access the 
ingredients if someone is mixing/cooking them.

So, if there is only one daemon running, it's safe to commit every 500 or 
every 1 with all the dbs: if you commit every row everytime you app will 
try to see the queue will see a "freshier" version of it, if you commit 
every 500 the app will see a "older" version of the queue.
The caveat of locking is valid for sqlite only: if you commit every 500 the 
app won't be allowed to read or write to the db while processing 1 to 500. 
If you commit every 1, the app will "lock" less.

Reply via email to