I have a mojolicious app which acts as a frontend to a resource, and
requires a websocket connection to that resource. I would like to run some
stuff in the background with Minion, but I don't want minion to also have
that connection. How would I make only the server and not the worker run
that code?

Illustrative example:

use Mojolicious::Lite;

plugin 'Minion' => { .... }; #configuration

#TODO- only run vvvv this in the server, not the worker
app->ua->websocket( 'ws://my.resource' => sub { ...  } ); #control things

get '/' => sub { ... } => 'dashboard';

app->minion->add_task( 'convert' => sub { ... } ); #external conversion
program
post '/file' => sub {
 ... #save the file away
app->minion->enqueue( 'convert' => [ ... ] ); #convert that file away
... # other stuff
} => 'upload';

app->start

-- 
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.

Reply via email to