Re: [Mojolicious] Minion args

2018-04-26 Thread Stefan Adams
Thanks, Dan! I'll try that. Yeah I don't need anything fancy, it's just a
large text string (a raw email message headers, attachments, and all,
actually).

I'm using Pg.


On Thu, Apr 26, 2018, 11:22 PM Dan Book  wrote:

> What backend are you using?
>
> Note that the args have to be decoded from JSON whenever accessed and when
> starting the job, which for pure-perl parsers can be very slow. Perhaps try
> loading Mojo::JSON::MaybeXS in your app. Otherwise I'd suggest storing it
> in a separate table in a way that doesn't require encoding or decoding, or
> using Sereal to serialize it for storage.
>
> -Dan
>
> On Fri, Apr 27, 2018 at 12:05 AM, Stefan Adams  wrote:
>
>> Is there a maximum length that I should respect for the args being passed
>> to a Minion task?
>>
>> I have a job that has an arg of 2MB and the state is failed with a result
>> of "Worker went away".  Using the Minion Admin UI, I clicked on the
>> "failed" tasks and it hangs my entire Ubuntu 16.04.3 system!  I've had to
>> reboot three times now.  I have since manually removed that specific job
>> from the database and now, so far, all seems to be well, and I can also
>> browse failed tasks (there are now 0).
>>
>> If I shouldn't be passing 2MB via args, should I instead save the 2MB to
>> disk and let the job remove the file from disk when the job has finished
>> successfully?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Mojolicious" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to mojolicious+unsubscr...@googlegroups.com.
>> To post to this group, send email to mojolicious@googlegroups.com.
>> Visit this group at https://groups.google.com/group/mojolicious.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mojolicious+unsubscr...@googlegroups.com.
> To post to this group, send email to mojolicious@googlegroups.com.
> Visit this group at https://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


Re: [Mojolicious] Minion args

2018-04-26 Thread Dan Book
What backend are you using?

Note that the args have to be decoded from JSON whenever accessed and when
starting the job, which for pure-perl parsers can be very slow. Perhaps try
loading Mojo::JSON::MaybeXS in your app. Otherwise I'd suggest storing it
in a separate table in a way that doesn't require encoding or decoding, or
using Sereal to serialize it for storage.

-Dan

On Fri, Apr 27, 2018 at 12:05 AM, Stefan Adams  wrote:

> Is there a maximum length that I should respect for the args being passed
> to a Minion task?
>
> I have a job that has an arg of 2MB and the state is failed with a result
> of "Worker went away".  Using the Minion Admin UI, I clicked on the
> "failed" tasks and it hangs my entire Ubuntu 16.04.3 system!  I've had to
> reboot three times now.  I have since manually removed that specific job
> from the database and now, so far, all seems to be well, and I can also
> browse failed tasks (there are now 0).
>
> If I shouldn't be passing 2MB via args, should I instead save the 2MB to
> disk and let the job remove the file from disk when the job has finished
> successfully?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mojolicious+unsubscr...@googlegroups.com.
> To post to this group, send email to mojolicious@googlegroups.com.
> Visit this group at https://groups.google.com/group/mojolicious.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Minion args

2018-04-26 Thread Stefan Adams
Is there a maximum length that I should respect for the args being passed
to a Minion task?

I have a job that has an arg of 2MB and the state is failed with a result
of "Worker went away".  Using the Minion Admin UI, I clicked on the
"failed" tasks and it hangs my entire Ubuntu 16.04.3 system!  I've had to
reboot three times now.  I have since manually removed that specific job
from the database and now, so far, all seems to be well, and I can also
browse failed tasks (there are now 0).

If I shouldn't be passing 2MB via args, should I instead save the 2MB to
disk and let the job remove the file from disk when the job has finished
successfully?

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.


[Mojolicious] Re: Problem with header data in json response

2018-04-26 Thread mjdev2017
Thanks both, that helped.

On Wednesday, April 25, 2018 at 3:31:10 PM UTC+1, mjde...@gmail.com wrote:
>
> Hi,
>
> I have a really annoying problem that I cannot resolve. I have a 
> Mojolicious (full) app running behind Apache (using mod_proxy path), when I 
> make an ajax call to my app for data the payload contains header data and 
> is not recognised as json, for example:
>
> Response payload
>
>
>
> *HTTP/1.1 N Content-Type: application/json;charset=UTF-8Content-Length: 
> 20Server: Mojolicious (Perl)Date: Wed, 25 Apr 2018 14:14:50 GMT*
>
> {"foo":[1,"test",3]}
>
> The payload response is fine if I access the app directly (not via Apache).
>
> My Apache config:
>
> 
> Require all granted
> 
> ProxyRequests Off
> ProxyPreserveHost On
>
> ProxyPass /app http://localhost:8080/app
> ProxyPassReverse /app http://localhost:8080/app
> ProxyPreserveHost On
> RequestHeader set X-Forwarded-HTTPS "0"
>
> In app startup:
>   $self->log->level('debug');
>   $self->hook('before_dispatch' => sub {
> my $self = shift;
> if ($self->req->headers->header('X-Forwarded-Host')) {
>   #Proxy Path setting
>   my $path = shift @{$self->req->url->path->parts};
>   push @{$self->req->url->base->path->parts}, $path;
> }
>   });
>
> route
> $r->get('/data/:status')->to('controller#action', status => 'N');
>
> controller
> sub action
> {
>   my $self = shift;
>   $self->render(json => {foo => [1, 'test', 3]});
> }
>
> I know this may not be directly realted to Mojolicious but can anyone see 
> what I'm doing wrong?
>
> MJ
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mojolicious+unsubscr...@googlegroups.com.
To post to this group, send email to mojolicious@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.