Skip to content

job run many times #11

Description

@misschuer

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions