Explorar o código

cmd_acc: explicit sql transaction begin for cdrs and rates generation

- GH #18
Daniel-Constantin Mierla %!s(int64=2) %!d(string=hai) anos
pai
achega
1716062be7
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      kamcli/commands/cmd_acc.py

+ 4 - 2
kamcli/commands/cmd_acc.py

@@ -241,8 +241,9 @@ def acc_cdrs_generate(ctx):
     ctx.vlog("Run SQL stored procedure to generate CDRS")
     e = create_engine(ctx.gconfig.get("db", "rwurl"))
     with e.connect() as c:
+        t = c.begin()
         c.execute("call kamailio_cdrs()")
-        c.commit()
+        t.commit()
 
 
 @cli.command(
@@ -420,5 +421,6 @@ def acc_rates_generate(ctx):
     )
     e = create_engine(ctx.gconfig.get("db", "rwurl"))
     with e.connect() as c:
+        t = c.begin()
         c.execute("call kamailio_rating()")
-        c.commit()
+        t.commit()