Parcourir la source

Move commit to commit less often

Foppe Hemminga il y a 6 ans
Parent
commit
b3886f96e5
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      main.py

+ 1 - 1
main.py

@@ -140,10 +140,10 @@ if __name__ == '__main__':
                 cur3 = db.cursor(cursor_factory=psycopg2.extras.NamedTupleCursor)
                 cur3.execute(query, (scratching.venue, scratching.date,
                                      scratching.race, scratching.horse))
-                db.commit()
                 cur3.close()
                 print('Stored: {}'.format(scratching))
                 time.sleep(0.5)
+        db.commit()
     db.close()
 
     interim = time.time()