~bnfo/aeroolib/aeroolib

« back to all changes in this revision

Viewing changes to openerp/modules/registry.py

  • Committer: Olivier Dony
  • Date: 2013-03-01 15:13:25 UTC
  • mfrom: (4864.1.1 7.0)
  • Revision ID: odo@openerp.com-20130301151325-2ygvwp1cx4zms1as
[MERGE] registry: another pass of cleanup for registry signaling

Some important points to consider:
 - signaling should be done after any schema alteration (including module [un]installation),
   service registration (e.g. reports)
 - the changes need to be committed to the database *before* signaling, otherwise an
   obvious race condition occurs during reload by other workers
 - any call to restart_pool() must be considered a possible candidate for
   signaling, and the 2 above conditions must be checked

The number of explicit calls was reduced by forcing the signaling at the end of
Registry.new() in case `update_module` was passed as True. In that situation
we always want to signal the changes - so all the redundant signaling calls
can be centralized. We can also assume that the relevant changes have already
been committed at that point, otherwise the registry update would not
have worked in the first place.
This means that there is no need for explicit signaling anymore everytime
`restart_pool` is called with `update_module=True`.

Some missing cr.commit() and explicit signaling calls were added or
moved to the right place. As a reminder: signaling must be done
*after* committing the changes, and usually *after* reloading the
registry on the current worker.

Show diffs side-by-side

added added

removed removed

Lines of Context:
232
232
 
233
233
        registry.ready = True
234
234
 
 
235
        if update_module:
 
236
            # only in case of update, otherwise we'll have an infinite reload loop!
 
237
            cls.signal_registry_change(db_name)
235
238
        return registry
236
239
 
237
240
    @classmethod