Loading lib/Travelynx.pm +25 −7 Original line number Diff line number Diff line Loading @@ -1485,6 +1485,7 @@ sub startup { ); my $stats = $self->compute_journey_stats(@journeys); eval { $self->pg->db->insert( 'journey_stats', { Loading @@ -1494,6 +1495,23 @@ sub startup { data => JSON->new->encode($stats), } ); }; if ( my $err = $@ ) { if ( $err =~ m{duplicate key value violates unique constraint} ) { # When a user opens the same history page several times in # short succession, there is a race condition where several # Mojolicious workers execute this helper, notice that there is # no up-to-date history, compute it, and insert it using the # statement above. This will lead to a uniqueness violation # in each successive insert. However, this is harmless, and # thus ignored. } else { # Otherwise we probably have a problem. die($@); } } return $stats; } Loading Loading
lib/Travelynx.pm +25 −7 Original line number Diff line number Diff line Loading @@ -1485,6 +1485,7 @@ sub startup { ); my $stats = $self->compute_journey_stats(@journeys); eval { $self->pg->db->insert( 'journey_stats', { Loading @@ -1494,6 +1495,23 @@ sub startup { data => JSON->new->encode($stats), } ); }; if ( my $err = $@ ) { if ( $err =~ m{duplicate key value violates unique constraint} ) { # When a user opens the same history page several times in # short succession, there is a race condition where several # Mojolicious workers execute this helper, notice that there is # no up-to-date history, compute it, and insert it using the # statement above. This will lead to a uniqueness violation # in each successive insert. However, this is harmless, and # thus ignored. } else { # Otherwise we probably have a problem. die($@); } } return $stats; } Loading