[openstreetmap/openstreetmap-website] Api timeout rollbacks (#1381)

Matt Amos notifications at github.com
Mon Nov 28 19:01:06 UTC 2016

> Do we actually need a separate class?

I haven't added a new class, `OSM::APITimeoutError` already existed, and the previous code rescued `Timeout::Error` to raise `OSM::APITimeoutError`. So, for the API path at least, the code is much simplified.

I'm not sure why, but `Timeout::Error` doesn't seem to be a regular, rescue-able exception, otherwise the code in Rails for detecting errors would already work. Have a look at the [gist I put together](https://gist.github.com/zerebubuth/8211e07e9f592e5b8146dea2344906b7) for more details.

> Also, do we need to do it for the web timeout?

It's less important, I agree. Some web methods do alter the database and might suffer from the same problem if they're able to partially commit without breaking a database constraint. Anywhere there's a `save!` in a loop would do it. I'd rather be safe, and add a few extra lines of code, than find out this introduces a race condition somewhere.

You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20161128/39b1bbf0/attachment.html>

More information about the rails-dev mailing list