Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re^2: Mojo: non-blocking API calls

by Beatnik (Parson)
on Nov 27, 2016 at 22:35 UTC ( #1176667=note: print w/replies, xml ) Need Help??

in reply to Re: Mojo: non-blocking API calls
in thread Mojo: non-blocking API calls

No specific code for the non-blocking right now. I'm currently only loading from the database but the release candidate will need to work the application. Each API call can take a few seconds. With bulk changes on the data, I'm trying to limit the wait for the user. I was considering Minion to run the synchronization process as a background job but that won't update the application immediately. My API module is Net::Cisco::ACS, which is based on LWP::UserAgent. As far as I can tell from looking at Mojo::UserAgent, I should not have any issue swapping out the code. My only concern is where I would need to add the IOLoop block? Would my module method need something extra? I'll need to do some more reading on this, I guess :)

... I'm belgian but I don't play one on TV.

Replies are listed 'Best First'.
Re^3: Mojo: non-blocking API calls
by stevieb (Canon) on Nov 27, 2016 at 22:54 UTC
    "I'll need to do some more reading on this, I guess"

    Quite probable. From what you're describing, it's a shot in the dark unless one of the monks has experience in exactly what you're dealing with.

    After reading more, and with some testing, you should be able to provide code snips that show the issue in action. I can think of a few things off the bat, but I'm afraid they'll be irrelevant and slant this thread sideways for no reason.

    For instance... in one of my apps recently using Dancer2, I had to sway from their db plugin so that I could run my db inserts/updates inside of an event outside the main application, so that there was no holdup. That won't work in all cases though, so keep us apprised on what you find when you can get a bit more specific.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1176667]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (1)
As of 2021-10-17 23:19 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (72 votes). Check out past polls.