Re: Saving application state
Thanks guys. I think I'll go with Rocco's suggestion. Since I'll be reading and writing probably only 7 to 10 characters, should be no worries about call being blocked. Besides, I probably want the previous data already in the file before the next iteration, now that I think about it. And I also like your suggestion about using File::AtomicWrite. On Thu, Feb 13, 2014 at 1:37 PM, Rocco Caputo wrote: > Hi, Celso. > > This isn't a job for POE. > > Use File::AtomicWrite, or something like it, to safely write the time > stamp as frequently as necessary. It's a trivial amount of data, so you > probably don't need it written asynchronously. > > Reload the time stamp when the program restarts. > > -- > Rocco Caputo > > On Feb 13, 2014, at 13:21, Celso Barriga wrote: > > > Hello, it's me again :) > > > > I have a POE-based application that queries a web app for some data > filtered on some time range, say, "send me any changes from time x to now". > > > > The application will be running 24/7, and will query for more changes > since the last time it asked for changes. I have a tick handler that keeps > the heartbeat going every second so I can do the query repeatedly. > > > > I need to save the last time it made the query in some persistent > fashion so I can pass it in my next query. I can't just save it to my heap > in case the application quits, I need to be able to resume the query since > the last successful query. > > > > What is the best way of doing this, the "POE way". Can I just save it to > a file and read it back every tick count, which is 1 sec, using a regular > file handle? > > > > Thanks in advance! > > > > Celso > > > > > >
Re: Saving application state
Hi, Celso. This isn't a job for POE. Use File::AtomicWrite, or something like it, to safely write the time stamp as frequently as necessary. It's a trivial amount of data, so you probably don't need it written asynchronously. Reload the time stamp when the program restarts. -- Rocco Caputo On Feb 13, 2014, at 13:21, Celso Barriga wrote: > Hello, it's me again :) > > I have a POE-based application that queries a web app for some data filtered > on some time range, say, "send me any changes from time x to now". > > The application will be running 24/7, and will query for more changes since > the last time it asked for changes. I have a tick handler that keeps the > heartbeat going every second so I can do the query repeatedly. > > I need to save the last time it made the query in some persistent fashion so > I can pass it in my next query. I can't just save it to my heap in case the > application quits, I need to be able to resume the query since the last > successful query. > > What is the best way of doing this, the "POE way". Can I just save it to a > file and read it back every tick count, which is 1 sec, using a regular file > handle? > > Thanks in advance! > > Celso > >
Saving application state
Hello, it's me again :) I have a POE-based application that queries a web app for some data filtered on some time range, say, "send me any changes from time x to now". The application will be running 24/7, and will query for more changes since the last time it asked for changes. I have a tick handler that keeps the heartbeat going every second so I can do the query repeatedly. I need to save the last time it made the query in some persistent fashion so I can pass it in my next query. I can't just save it to my heap in case the application quits, I need to be able to resume the query since the last successful query. What is the best way of doing this, the "POE way". Can I just save it to a file and read it back every tick count, which is 1 sec, using a regular file handle? Thanks in advance! Celso