New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing delay (sleep, Thread.sleep) in mruby? #1283
Comments
hi @taosx not sure if you did this intentionally to emulate pauses but from what i read you're join for every request sequentally. The idea would be that the requests go out in parallel, so you only start joining after all requests are fired. can you try something like
and post a more detailed error description? also if its always the same few links and they are more or less static you could quickly implement a cheap in memory cache. |
I believe your code is not providing an argument to http_request, I modified like so: After I do some more tests I would like to open source the whole code for my wordpress site with h2o which caches pages every 2 minutes, precompresses with both gzip and brottli at max settings and serves from cache. Love h2o so far, thank all the contributors to h2o!! In the future I would love to see more scripting features for h2o, like openresty but based on h2o :D |
@taosx ah sorry. i forgot the crucial part:
just out of curiosity, can you try that again. and how many requests do you make / how big is the links array? |
@yannick I tried again, i had to modify http_request to give it's argument (l). Everytime I add another post i get 1 link from the post itself + ~5 links from tags added... Do you think I could use h2o with mruby as a reverse proxy cache for wp, I believe it's possible. |
it seems that you shell out to php via links = yes caching via mruby should be possible, either you do it in memory or you use redis (which currently still needs a patch but should be merged soon, see #1152 ) |
This is an interesting discussion! Aside from how the issue should be resolved (e.g. by implementing a cache using mruby), I believe that there is no reason why we should not provide a sleep function in our mruby handler. |
I wrote a mruby handler which uses http_request to keep my cache fresh in wordpress but because I don't know of any way to sleep the handler and it does too many requests it fails the request because php can't keep up.
Is there any way to sleep for some seconds in h2o using mruby (I tried installing custom Thread mruby extension but I can't seem to get date for response out of thread)?
The error:
[lib/handler/fastcgi.c] in request:/index.php/tag/science:connection failed:failed to connect to host
The code:
The text was updated successfully, but these errors were encountered: