Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

job run many times #11

Open
misschuer opened this issue Oct 16, 2018 · 0 comments
Open

job run many times #11

misschuer opened this issue Oct 16, 2018 · 0 comments

Comments

@misschuer
Copy link

misschuer commented Oct 16, 2018

today i write a demo, i just execute muti_sql with 40000 sqls, but the same job do twice, why?
i guess when the job time exceed 70s, it ocurrs.

lua script is:
function _M.perform(job)
-- job is an instance of Qless_Job and provides access to
-- job.data (which is a Lua table), a means to cancel the
-- job (job:cancel()), and more.

-- return "nil, err_type, err_msg" to indicate an unexpected failure

if not job.data then
    return nil, "job-error", "data missing"
end

utils.print_err_format("job perform start........... workerid = %s, len=%s", ngx.worker.id(), #job.data)
-- Do work
local sqls = utils.string_join("\n", job.data)
local ret, err = db_utils:execute_sql("", sqls, true)
if err then
    utils.print_err_format("err %s", tostring(err))
end
utils.print_err_format("job perform end workerid = %s", ngx.worker.id())
if ret then
    utils.print_err_format("last insert_id = %s", ret.insert_id)
end

end

my log is:
2018/10/16 18:05:36 [error] 27659#27659: *1317 [lua] utils.lua:465: print_err_format(): job perform start........... workerid = 0, len=40000, context: ngx.timer
2018/10/16 18:06:46 [error] 27659#27659: *2445 [lua] utils.lua:465: print_err_format(): job perform start........... workerid = 0, len=40000, context: ngx.timer
2018/10/16 18:07:25 [error] 27659#27659: *1317 [lua] utils.lua:465: print_err_format(): job perform end workerid = 0, context: ngx.timer
2018/10/16 18:07:25 [error] 27659#27659: *1317 [lua] utils.lua:465: print_err_format(): last insert_id = 919109, context: ngx.timer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant