timer trigger - azure webjob does not stop (keeps working after stopping has been requested) -
we have following situation.
we decided use webjob in 1 of our web app perform work every 30 seconds.
for purpose use following code called main function:
static void run(bool locally) { jobhostconfiguration config = new jobhostconfiguration(); if (locally) { config.tracing.consolelevel = tracelevel.verbose; config.usedevelopmentsettings(); }config.usetimers(); jobhost host = new jobhost(config); host.runandblock(); }
we have method in webjob triggered timer:
public static async task timerjob([timertrigger("00:00:30")] timerinfo timer) {.... ienumerable<iinvitationprocessor> processors = _container.resolve<ienumerable<iinvitationprocessor>>(); .... }
where _container - autofac container
we noticed 2 strange different things(it looks linked):
1) if stop webjob using th portal webjob dispalyed stopped in fact keeps working - see logs in log on portal , logs in appinsights our webjob code writes to. restarting of webapp not help. only
way stop delete webjob(in fact keeps working) , restart webapp. after webjob stopped(in fact disappears ).
p.s.: our webjob uses timertrigger in turn uses distributed lock garantee 1 instance of wbjob called(every 30 seconds). locally started instance manages acquire lock after above actions(deletion adn restart) hav been performed. - evidence "deleted\stopped" webjob keeps running.
2) after time(perhaps after redeploy) our webjob starts raising following exception
system.io.filenotfoundexception handled @ autofac.core.activators.reflection.constructorparameterbinding.instantiate
while trying resolve dependencies(it looks strange because of time dependecies resolved - while deployed on azure web app or locally)
thanks
Comments
Post a Comment