浏览代码

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()