diff --git a/plugins/webstats/lua/webstats_common.lua b/plugins/webstats/lua/webstats_common.lua index 82113a8d3..0733ed7bb 100644 --- a/plugins/webstats/lua/webstats_common.lua +++ b/plugins/webstats/lua/webstats_common.lua @@ -120,6 +120,8 @@ function _M.cron(self) local db = dbs[input_sn] if db then + db:exec([[BEGIN TRANSACTION]]) + stmt2_pre = db:prepare[[INSERT INTO web_logs( time, ip, domain, server_name, method, status_code, uri, body_length, referer, user_agent, protocol, request_time, is_spider, request_headers, ip_list, client_port) @@ -205,8 +207,6 @@ function _M.store_logs(self, db, stmt2, info) self:lock_working(input_sn) - db:exec([[BEGIN TRANSACTION]]) - self:store_logs_line(db, stmt2, input_sn, info) local res, err = stmt2:finalize()