Announcement
Collapse
No announcement yet.
miva_sleep Not Working
Collapse
X
-
Thank you for taking the time to test the code and your explanation makes sense.
I see what I did wrong and will fix it tomorrow.
I'm using this to debug a race issue that I think I'm having. Or it may not be a race issue but something completely different.
TGIF
Leave a comment:
-
s.dyn_time_t is a number of seconds. So if your script runs for only half a second, s,dyn_time_t can't advance more than 1; and about half the time, it won't advance at all.
I tested your script after changing the "500" to "g.sleep_time," so that I could enter different numbers as a URL parameter. With 500, as expected, it shows sleep_duration results of 0 or 1. I changed the sleep time tp 5000, i.e. 5 seconds, and I got a noticeable delay. So I think the software is performing correctly, at least in my store.
Leave a comment:
-
Hi Kent, Thanks for the reply.
Yeah, its just a half a second.
The code snippet benchmarks the miva_sleep() and returns 0.
I'm getting timestamps so I don't think its a server issue but something is wrong.
I don't want to use a while loop because its CPU heavy.
Could you look at or test the code and see if you eval a sleep_duration?
Leave a comment:
-
You do know that miva_sleep measures time in milliseconds, right?
Leave a comment:
-
miva_sleep Not Working
miva_sleep is not evaluating.
Code:<mvt:assign name="g.sleep_start" value="s.dyn_time_t" />sleep_start: <mvt:eval expr="g.sleep_start" /><br> <mvt:assign name="g.has_sleep" value="miva_sleep(500)" />has_sleep: <mvt:eval expr="g.has_sleep" /><br> <mvt:assign name="g.sleep_end" value="s.dyn_time_t" />sleep_end: <mvt:eval expr="g.sleep_end" /><br> <mvt:assign name="g.sleep_duration" value="g.sleep_end - g.sleep_start" />sleep_duration: <mvt:eval expr="g.sleep_duration" /><br>
Code:<mvt:assign name="g.while_delay_start" value="s.dyn_time_t" />while_delay_start: <mvt:eval expr="g.while_delay_start" /><br> <mvt:assign name="g.while_delay" value="500" />while_delay: <mvt:eval expr="g.while_delay" /><br> <mvt:assign name="g.while_delay_stop" value="g.while_delay_start + g.while_delay" />while_delay_stop: <mvt:eval expr="g.while_delay_stop" /><br> <mvt:while expr="s.dyn_time_t LE g.while_delay_stop"> </mvt:while> <mvt:assign name="g.while_delay_end" value="s.dyn_time_t" />while_delay_end: <mvt:eval expr="g.while_delay_end" /><br> <mvt:assign name="g.while_duration" value="g.while_delay_end - g.while_delay_start" />while_duration: <mvt:eval expr="g.while_duration" /><br>
Tags: None
Leave a comment: