Fetchmail breaks cron transaction policy

Fetchmail module installs a method to process mail messages from incoming mail servers.

This method is called by ir.cron periodically. ir.cron uses a db locking strategy on cron job record to prevent simoultaneous call by multiple workers threads on the same job.

Fetchmail cron method receives the cursor from cron and reuses it making a cr.commit on each received message, thus breaking the lock policy of to prevent simoultaneous execution. The net effect is that fetchmail is called several times when message collecting from input mail servers takes longer than the interval between cron calls (60 seconds)(a common situation when the server is configured with slow mail services). In my cases this process ends up with stalled cron fetchamail process, and thus NO MAIL WAS COLLECTED unless you manually reset the server

The solution is to use a separate cursor to process incoming messages

See https://bugs.launchpad.net/openobject-addons/+bug/1228421