ソースを参照

cmd_acc: explicit sql transaction begin for cdrs and rates generation

- GH #18
Daniel-Constantin Mierla 2 年 前
コミット
1716062be7
1 ファイル変更4 行追加2 行削除
  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()