Acme-CPANModulesBundle-Import-MojoliciousAdvent-2018
view release on metacpan or search on metacpan
devdata/https_mojolicious.io_blog_2018_12_06_making-a-list-with-yancy_ view on Meta::CPAN
254255256257258259260261262263264265266267268269270271272273274
%=
$item
-
>
;{address}
<
;/div
>
;
% end
<
;/li
>
;
% }
<
;/ul
>
;
</code></pre>
<h1>Step 3: Complete Delivery</h1>
<p>Santa&
#39;s a busy robot, and all that ordnance is expensive. Once he's done
a delivery, he needs to mark it as done so he can move on to all the
other deserving people.</p>
<p><img alt="Santa Robot (from Futurama) writing on his list
with
a quill
pen
" src="
editing-list.png"></p>
<p>Stopping to check people off manually really slows down the murder and
mayhem.</p>
<p>Yancy makes it easy to update the data, this
time
with
the <a href=
"https://metacpan.org/pod/Yancy::Controller::Yancy#set"
>
"
;set
"
; action
devdata/https_mojolicious.io_blog_2018_12_12_dancer-and-minion_ view on Meta::CPAN
338339340341342343344345346347348349350351352353354355356357
$job
-
>
;on( failed =
>
;
sub
(
$job
,
$error
) {
chomp
$error
;
$logger
-
>
;error(
$error
);
});
});
</code></pre>
<p>To help us
for
future capacity planning, we want
our
workers to
tell
us
if
they are running at peak capacity, so
log
when
this event occurs:</p>
<pre><code>
$worker
-
>
;on( busy =
>
;
sub
(
$worker
) {
my
$max
=
$worker
-
>
;status-
>
;{ jobs };
$logger
-
>
;
log
(
"
;$0: Running at capacity (performing
$max
jobs).
"
; );
});
</code></pre>
<p>Now, we apply the configuration (
read
below) to the worker. When the worker starts, it tells us information about how it was configured (this was really useful during development):</p>
<pre><code>
my
$max_jobs
=
$hostconfig
-
>
;{ max_children };
my
@queues
= @{
$hostconfig
-
>
;{ queues }};
( run in 0.254 second using v1.01-cache-2.11-cpan-d6f9594c0a5 )