[hooks] fix timestamp confusion in TransactionsCleanupStartupHook
authorJulien Cristau <julien.cristau@logilab.fr>
Wed, 09 Dec 2015 13:58:03 +0100
changeset 10961 6ff786884aad
parent 10960 9e64fddebc89
child 10962 625b951b4a1a
[hooks] fix timestamp confusion in TransactionsCleanupStartupHook transactions.tx_time is inserted as datetime.utcnow(), in server/sources/native.py:NativeSQLSource.start_undoable_transaction. Don't compare it to datetime.now().
hooks/__init__.py
--- a/hooks/__init__.py	Thu Dec 10 12:34:15 2015 +0100
+++ b/hooks/__init__.py	Wed Dec 09 13:58:03 2015 +0100
@@ -33,7 +33,7 @@
         # which may cause reloading pb
         lifetime = timedelta(days=self.repo.config['keep-transaction-lifetime'])
         def cleanup_old_transactions(repo=self.repo, lifetime=lifetime):
-            mindate = datetime.now() - lifetime
+            mindate = datetime.utcnow() - lifetime
             with repo.internal_cnx() as cnx:
                 cnx.system_sql(
                     'DELETE FROM transactions WHERE tx_time < %(time)s',