I have a page that displays json output, it's supposed to sleep if there's no content and wait for there to be content. Sometimes though it returns right away with no content and the header information is a 304 "Not Modified" response. Any ideas why? I noticed doing a hard refresh (f5) fixes it, only temporarily though.
Thanks. I actually did read that but I'm not on lightspeed and I feel like it's still going to kill my script. The issue is that whatever causes it to return the 304 header is also causing my sleep function to not work. Whenever it doesn't return that header, it sleeps just fine.
Is your sleep function before or after the header? It may occur on other systems, but the above fix shouldn't change anything in your script except explicitly return "application/json". A 304 Not Modified is still returned.