This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package MojoX::InsistentPromise; | |
use strict; | |
use Carp; | |
my @retry_pos = (0, 0.5, 1, 3, 7, 13, 21, 34, 55, 60, 120); | |
$_ = $_ / 10000 for @retry_pos; # Test only! | |
use Scalar::Util 'weaken'; | |
sub new { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use Mojo::Promise; | |
use Mojo::UserAgent; | |
use DDP; | |
use Memory::Usage; | |
my $mu = Memory::Usage->new(); | |
my $ua = Mojo::UserAgent->new->inactivity_timeout(1); | |
my $max_fail_num = 100; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl lost-and-found/promises-retry-test.pl | |
time vsz ( diff) rss ( diff) shared ( diff) code ( diff) data ( diff) | |
0 116440 ( 116440) 39960 ( 39960) 7388 ( 7388) 2944 ( 2944) 32912 ( 32912) starting work | |
4 489688 ( 373248) 44448 ( 4488) 7388 ( 0) 2944 ( 0) 79120 ( 46208) Iteration 1000 | |
10 492144 ( 2456) 47088 ( 2640) 7388 ( 0) 2944 ( 0) 81576 ( 2456) Iteration 2000 | |
14 492144 ( 0) 47088 ( 0) 7388 ( 0) 2944 ( 0) 81576 ( 0) Iteration 3000 | |
17 492144 ( 0) 47088 ( 0) 7388 ( 0) 2944 ( 0) 81576 ( 0) Iteration 4000 | |
22 492144 ( 0) 47088 ( 0) 7388 ( 0) 2944 ( 0) 81576 ( 0) Iteration 5000 | |
26 492144 ( 0) 47088 ( 0) 7388 ( 0) 2944 ( 0) 81576 ( 0) Iteration 6000 | |
30 492144 ( 0) 47088 ( 0) 7388 ( 0) 2944 ( 0) 81576 ( 0) Iteration 7000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use Mojo::Promise; | |
use Mojo::UserAgent; | |
use DDP; | |
my $ua = Mojo::UserAgent->new->with_roles('+Queued')->inactivity_timeout(1); | |
my $max_fail_num = 100; | |
my $results_count = {}; | |
my @retry_pos = (0, 0.5, 1, 2, 4, 5, 10, 20, 25, 30, 40); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use Mojo::Promise; | |
use Mojo::UserAgent; | |
use DDP; | |
my $ua = Mojo::UserAgent->new->with_roles('+Queued')->inactivity_timeout(1); | |
my $max_fail_num = 100; | |
my $results_count = {}; | |
my @retry_pos = (0, 0.5, 1, 2, 4, 5, 10, 20, 25, 30, 40); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use Mojo::Promise; | |
use Mojo::UserAgent; | |
use DDP; | |
my $ua = Mojo::UserAgent->new->with_roles('+Queued')->inactivity_timeout(60); | |
my $max_fail_num = 100; | |
my $results_count = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub parse { | |
my $self = shift; | |
my $text = lc shift; | |
my $ret = shift; | |
$ret->{fixed} ||= 0; | |
return 'overflow_error' if $ret->{fixed} > 4; # nunca deve ocorrer, mas bugs sempre estao soltos. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package YOURAPP::Logger; | |
use strict; | |
use DateTime; | |
use IO::Handle; | |
use Log::Log4perl qw(:easy); | |
if ( $ENV{YOURAPP_API_LOG_DIR} ) { | |
if ( -d $ENV{YOURAPP_API_LOG_DIR} ) { | |
my $date_now = DateTime->now->ymd('-'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question group: Atividade física (ID:26) | |
Code: q3 : (Optional question) | |
Question: How much time per day do you do vigorous intensity activities at work? if(is_empty(q3_m), 1, q3_m <= 59) && if(is_empty(q3_h), 1, q3_h <= 16) && if( ! is_empty(q3_h) && q3_h == 0 && q3_m == 0, "Ambos não podem ser zero", if(is_empty(q3_h) && ! is_empty(q3_m) && q3_m == 0, "Você deve preencher pelo menos com 1 minuto ou deixar ambos campos vazios.", "")) if(if(is_empty(q3_m), 1, if(q3_m < 60, 1, 0)) && if(is_empty(q3_h), 1, if(q3_h <= 16, 1, 0)), '', 'valor deve ser menor que 16 horas e 59 minutos') | |
Help: | |
Type: Multiple numerical input | |
Mandatory: No | |
Relevance equation: ! is_empty(q2.code) | |
Hide tip: 1 | |
CSS class(es): force-hide-tips hour-minute-input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package Queryexporter::Controller::Query::ViewRows; | |
use Mojo::Base 'Queryexporter::Controller'; | |
use JSON; | |
sub preview { | |
my $c = shift; | |
my $user = $c->stash->{user_rs}->next or $c->user_not_found; | |
$c->subprocess( | |
sub { |