Changeset 807 for trunk/packages/sipb-xen-base/files/usr
- Timestamp:
- Aug 1, 2008, 2:34:31 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/sipb-xen-base/files/usr/share/python-support/sipb-xen-base/invirt/config.py
r806 r807 17 17 """ 18 18 19 # Namespace container for various state variables, so that they can be20 # updated byclosures.19 # Namespace container for state variables, so that they can be updated by 20 # closures. 21 21 ns = struct() 22 22 … … 25 25 else: 26 26 src_mtime = getmtime(src_path) 27 try: cache_mtime = getmtime(cache_path) 28 except OSError: do_refresh = True 29 else: do_refresh = src_mtime > cache_mtime 27 try: cache_mtime = getmtime(cache_path) 28 except OSError: do_refresh = True 29 else: do_refresh = src_mtime + 1 >= cache_mtime 30 31 # We chose not to simply say 32 # 33 # do_refresh = src_mtime >= cache_time 34 # 35 # because between the getmtime(src_path) and the time the cache is 36 # rewritten, the master configuration may have been updated, so future 37 # checks here would find a cache with a newer mtime than the master 38 # (and thus treat the cache as containing the latest version of the 39 # master). The +1 means that for at least a full second following the 40 # update to the master, this function will refresh the cache, giving us 41 # 1 second to write the cache. Note that if it takes longer than 1 42 # second to write the cache, then this situation could still arise. 43 # 44 # The getmtime calls should logically be part of the same transaction 45 # as the rest of this function (cache read + conditional cache 46 # refresh), but to wrap everything in an flock would cause the 47 # following cache read to be less streamlined. 30 48 31 49 if not do_refresh:
Note: See TracChangeset
for help on using the changeset viewer.