cubehouse / themeparks

Unofficial API for accessing ride wait times and schedules for Disneyland, Disney World, Universal Studios, and many more parks
MIT License
540 stars 126 forks source link

Long-Polling error #200

Closed eduardo-veras closed 5 years ago

eduardo-veras commented 5 years ago

Park Not sure, but I think Disney parks

Context

Describe the bug I have a small docker container that updates the parks opening times and within 1-hour interval (defined thru setInterval), and save the information in a mongodb collection. Every time that the function is executed, a new connection with the mobodb server is made.

After running the container for some hours, I start to get "Long-polling errors" on the docker logs.

Looking up the themeparks codes, I was able to check that the error are being throw by the "needle" package (https://github.com/cubehouse/themeparks/blob/388cfdeb112307fcf5d61b4bd84e3d01eaec04a2/lib/disney/couchbaseChannel.js#L104).

I understand that prevent the recreation of the Park Class improves a lot the performance, but maybe a way to recycle the poolings after a few hours can solve this problem.

Output Long-Polling error: Error: socket hang up (starting long-poll again in 10 seconds} Long-Polling error: Error: socket hang up (starting long-poll again in 20 seconds} Long-Polling error: Error: socket hang up (starting long-poll again in 40 seconds} 401: { "type": "Buffer", "data": [] } 401: { "type": "Buffer", "data": [] }

cubehouse commented 5 years ago

This error is harmless, it means the long-poll was dropped by the server and it will be restarted.

It's nothing to do with pooling, or the class instantiation. This is the long HTTP request used to wait for database changes, which is a common technique to fetch live data using HTTP requests without needing websockets.

I'm going to remove the error nature of this to stop people worrying.

If you are seeing any errors occurring with the output, please raise an issue about that separately.