Hi in my app logs there is userid:
$self->hook( before_dispatch => sub {
my ($c) = @_;
Log::Log4perl::MDC->put('userid', $c->userid);
In few cases app makes request to external webservice using non-blocking
request. When external request for user A is pending then hypnotoad worker
takes another request of another user B and sets his userid in logs. When
external request for user A is completed then there is still userid of user
B in logs.
$r->get('/async')->to(cb => sub {
my ($c) = @_;
$c->app->log->debug("hello"); # user A in logs
$c->ua->get("http://hello.world" => sub {
my ($ua, $tx) = @_;
$c->app->log->debug("hello"); # user B in logs for request of user A
...
});
});
I know I can call "put(...)" once more in callback of ua->get but I have
few places like this, maybe you have some other ideas instead of copy-paste
it for each new non-blocking external request.
--
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 https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.
