hgext3rd/evolve/stablerangecache.py
branchstable
changeset 4027 130a60a51fff
parent 4026 b375398074b0
child 4029 a01783a0468c
equal deleted inserted replaced
4026:b375398074b0 4027:130a60a51fff
   182                 result = self._con.execute(_queryrange, rangeid).fetchone()
   182                 result = self._con.execute(_queryrange, rangeid).fetchone()
   183                 if result is not None: # database know about this node (skip in the future?)
   183                 if result is not None: # database know about this node (skip in the future?)
   184                     value = self._con.execute(_querysubranges, rangeid).fetchall()
   184                     value = self._con.execute(_querysubranges, rangeid).fetchall()
   185                 # in memory caching of the value
   185                 # in memory caching of the value
   186                 cache[rangeid] = value
   186                 cache[rangeid] = value
   187             except sqlite3.OperationalError:
   187             except (sqlite3.DatabaseError, sqlite3.OperationalError):
   188                 # something is wrong with the sqlite db
   188                 # something is wrong with the sqlite db
   189                 # Since this is a cache, we ignore it.
   189                 # Since this is a cache, we ignore it.
   190                 if '_con' in vars(self):
   190                 if '_con' in vars(self):
   191                     del self._con
   191                     del self._con
   192                 self._unsavedsubranges.clear()
   192                 self._unsavedsubranges.clear()
   234     def _save(self, repo):
   234     def _save(self, repo):
   235         if not self._unsavedsubranges:
   235         if not self._unsavedsubranges:
   236             return
   236             return
   237         try:
   237         try:
   238             return self._trysave(repo)
   238             return self._trysave(repo)
   239         except (sqlite3.OperationalError, sqlite3.IntegrityError) as exc:
   239         except (sqlite3.DatabaseError, sqlite3.OperationalError, sqlite3.IntegrityError) as exc:
   240             # Catch error that may arise under stress
   240             # Catch error that may arise under stress
   241             #
   241             #
   242             # operational error catch read-only and locked database
   242             # operational error catch read-only and locked database
   243             # IntegrityError catch Unique constraint error that may arise
   243             # IntegrityError catch Unique constraint error that may arise
   244             if '_con' in vars(self):
   244             if '_con' in vars(self):