~lifeless/python-oops-tools/bug-881400

« back to all changes in this revision

Viewing changes to src/oopstools/oops/dboopsloader.py

  • Committer: Tarmac
  • Author(s): Roman O. Yepishev
  • Date: 2011-10-24 19:25:45 UTC
  • mfrom: (4.1.1 update-date-when-needed)
  • Revision ID: launchpad@pqm.canonical.com-20111024192545-piemj1r90v3tslgf
Tune dboopsloader to avoid pointless commits to the last-processed date marker.

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
                        oops = self._load_oops(datedir, filename)
152
152
                        if oops is not None:
153
153
                            yield oops
154
 
                        # We do this every time because scripts that use
155
 
                        # it (update_db.py) might stop after any oops.
156
 
                        entry.last_date = date
157
 
                        entry.save()
 
154
                        # We update the last_date only when oops 
 
155
                        # has the date different to what we already have
 
156
                        # This speeds up the loading process
 
157
                        if entry.last_date != date:
 
158
                            entry.last_date = date
 
159
                            entry.save()
158
160
                date += datetime.timedelta(days=1)
159
161
 
160
162
    def _load_oops(self, datedir, filename):