Edgewall Software

Opened 9 years ago

Closed 9 years ago

#11904 closed defect (fixed)

Configuration.parse_if_needed takes forever to reload if clock is going back — at Version 4

Reported by: Jun Omae Owned by: Jun Omae
Priority: normal Milestone: 1.0.5
Component: general Version: 0.12-stable
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fix not reloading configuration if clock is going back.

API Changes:
Internal Changes:

Description (last modified by Jun Omae)

Configuration.parse_if_needed() reload only when the file is modified by checking that its modified time is greater that saved modified time.

However, if system clock is going back (e.g. by ntpdate), it would take forever to reload.

I think we should check difference between current and saved modified times.

  • trac/config.py

    diff --git a/trac/config.py b/trac/config.py
    index 7b233d5..41932e6 100644
    a b class Configuration(object):  
    267267
    268268        changed = False
    269269        modtime = os.path.getmtime(self.filename)
    270         if force or modtime > self._lastmtime:
     270        if force or modtime != self._lastmtime:
    271271            self._sections = {}
    272272            self.parser._sections = {}
    273273            if not self.parser.read(self.filename):

See [c4561077/jomae.git] (log:jomae.git@t11904).

Change History (4)

comment:1 by Jun Omae, 9 years ago

Description: modified (diff)

comment:2 by Ryan J Ollos, 9 years ago

Looks good to me. Since getmtime returns an int I can't see any issues with the not equals comparison.

comment:3 by Jun Omae, 9 years ago

Milestone: next-stable-1.0.x1.0.5
Owner: set to Jun Omae
Status: newassigned

Thanks for the reviewing! I'll push it after release of 1.0.4.

comment:4 by Jun Omae, 9 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Committed in [13747-13748].

Note: See TracTickets for help on using tickets.