None of the solutions you're looking for are reliable.

I would suggest logging each request when they happen. I'm logging all 
requests to a plain access log file, 
using https://metacpan.org/pod/Toadfarm::Plugin::AccessLog, but you can 
also use https://metacpan.org/pod/Mojolicious::Plugin::AccessLog

This should be very fast, especially if you log to a file on a ram disk.

Other option could be syslog to localhost. It *should be* very reliable, 
even if UDP by nature is not...


On Friday, July 31, 2015 at 6:41:11 PM UTC+2, Хозов Андрей wrote:
>
> For example you need to process many events and store its in database. 1 
> http request -- 1 event. In action you can store events to buffer (e.g. 
> attribute of
> mojolicious application). And you have recurring timer to save data into 
> database via bulk request. All is OK until worker with application is 
> restarted. Some
> ​​events will be lost in this case. So I think you need to catch 
> terminating application event.
>
> There is another option to catch TERM and QUIT signals. But it doesn't 
> look too reliable.
>
>
> On Fri, Jul 31, 2015 at 9:27 PM, Jan Henning Thorsen <
> [email protected]> wrote:
>
>> It sounds like you're seeking the wrong solution, but it's impossible to 
>> tell for sure without more detailed information.
>>
>> If you're on the right track, then maybe you need END {...}, but there's 
>> no guaranties for any of these solutions to actually work.
>>
>>
>> On Friday, July 31, 2015 at 5:51:41 PM UTC+2, Хозов Андрей wrote:
>>>
>>> What is the best way to see that Mojolicious app is terminated 
>>> (application running via hypnotoad/morbo)? This can be useful when you need 
>>> to aggregate some data in memory and periodically flushing the data in the 
>>> persistent store.
>>>
>>> Should I use sub DESTROY inside the app for this? Or I need just 
>>> subscribe to the event finish in Mojo::IOLoop?  Are there any ways to do 
>>> this?
>>>
>>>
>>> -- 
>>> Andrey Khozov
>>>
>>
>
>
> -- 
> Andrey Khozov
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.

Reply via email to