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

254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
                %= $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&#39;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">&quot;set&quot; action

devdata/https_mojolicious.io_blog_2018_12_12_dancer-and-minion_  view on Meta::CPAN

338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
    $job-&gt;on( failed =&gt; sub( $job, $error ) {
        chomp $error;
        $logger-&gt;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-&gt;on( busy =&gt; sub( $worker ) {
    my $max = $worker-&gt;status-&gt;{ jobs };
    $logger-&gt;log( &quot;$0: Running at capacity (performing $max jobs).&quot; );
});
</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-&gt;{ max_children };
my @queues   = @{ $hostconfig-&gt;{ queues }};



( run in 0.254 second using v1.01-cache-2.11-cpan-d6f9594c0a5 )