Replies: 4 comments 7 replies
-
|
I suppose you started this app with morbo? Well, then your app is just one process. In this case, your user agent will wait until the time expires. After that, it will throw a 500 error and only then morbo will process the request that your user agent made. Launch this app with prefork (multiple processes):
|
Beta Was this translation helpful? Give feedback.
-
|
Applications requesting from themselves is not supported. I suggest refactoring so that you can call the common code as a helper or method, or splitting up the application. |
Beta Was this translation helpful? Give feedback.
-
|
I agree wholly with @Grinnz that you should just factor out common code. Other than that, switching |
Beta Was this translation helpful? Give feedback.
-
|
The issue is that the $ua inside your blocking get() use Here is another example that will work nomatter which port you start your app on: (I haven't run the code, so there might be dragons) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Maybe there is something in the inner workings off Mojolicious that I do not yet understand but I cannot seem to figure out how to call a route from the same app using Mojo::UserAgent inside the app. If I use Mojo::UA to call out to an external site it works fine. I have a large app that uses Mojo (bugzilla.mozilla.org) but I have created a test case in Mojo::Lite for demostration.
If I start the above the the call times out and tries several times.
If instead of using
http://localhost:3000and just use/testin the Mojo::UA get() then it works instantly.If I use Mojo::UA and call out to an external API site not currently on localhost, it also works. What am I missing with regards to making a request to the current app running on localhost:3000 as if it were some far away site?
Another question somewhat related, If I wanted to do away with using Mojo::UA in the
/fooroute, how would i slurp in the result of the/testroute and access the returned JSON data instead of using $c->redirect_to()?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions