expires vs expiration
It appears I have misunderstood the difference between `expires => time() + 3600` and `expiration => 3600` as I thought `expires` would just set the expiration one time and not update for subsequent requests. Per this discussion thread, that does not appear to be correct: https://github.com/mojolicious/mojo/discussions/1833 Thus I felt it best to just set the expiry period to 30 min and allow that to reset on subsequent requests rather than reinvent the wheel
This commit is contained in:
parent
a36e43ea11
commit
80b2acb79a
|
@ -43,14 +43,10 @@ under sub ($c) {
|
||||||
unless ($c->session('counted')) {
|
unless ($c->session('counted')) {
|
||||||
$c->counter->increment_visitor_count();
|
$c->counter->increment_visitor_count();
|
||||||
$c->session(
|
$c->session(
|
||||||
expires => time() + 3600,
|
expiration => 1800,
|
||||||
counted => 1
|
counted => 1
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
# Delete this since I was supposed to be using 'expires' instead
|
|
||||||
# of 'expiration'; the difference is outlined here:
|
|
||||||
# https://docs.mojolicious.org/Mojolicious/Controller#session
|
|
||||||
delete $c->session->{'expiration'} if $c->session('expiration');
|
|
||||||
|
|
||||||
$c->stash(status => 403) if $c->flash('error');
|
$c->stash(status => 403) if $c->flash('error');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user