开发者

Do scheduled tasks load Application.cfc in the same way as web pages?

Do scheduled tasks load the Application.cfc in the same way as web pages? We have a task which runs nightly and needs to use a services cfc loaded into the application. Will the application scope exist in the same way as it does when calling a standard web page? Are there any differences 开发者_Go百科or gotchas to watch out for?


The CF task scheduler makes an HTTP call to the URL you specify in the task, so all standard rules apply. Application.cfm/application.cfc is run, the app scope exists, and so forth.

The only thing, offhand, you need to keep in mind is that the scheduler itself doesn't recognize errors, so you should write the task in such a way that it logs, emails, etc. on error. And, during testing, probably on success.

Edit: Sergii noted something I'd overlooked. The scheduler doesn't maintain cookies. It acts more like a spider. Therefore, anything in the session or client scopes or written to cookies won't actually be stored, and will be lost next time the action is run.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜