Re: [Cppcms-users] best way for background processes
Brought to you by:
artyom-beilis
From: Artyom B. <art...@ya...> - 2012-04-24 20:16:10
|
> Hi everyone, > > my web application uses some background processes for time based things, > e.g. "crons", but I need access to the content itself. What is the > best > way to do this? My first thought was to mount a backgroundprocess as > async process and make async_waits, Yes, this is correct approach, for example, sessions garbage collection works this way > but if I try to access to the > context it says: "Assertion `px != 0' failed." See, cppcms::http::context is request/response context... Cron job does not have any request/response as it is not initiated by the client, so you are probably doing something wrong. Just create a event using deadline_timer, and submit a job to the thread pool or if it is something very short execute it in the event loop itself. Artyom |