Streetcomplete: Retry activating photo in note on timeout

Created on 21 Sep 2020  路  6Comments  路  Source: westnordost/StreetComplete

How to Reproduce
I'm unsure, as future and subsequent uploads succeeded, although this is the only double upload I've ever tried.
https://www.openstreetmap.org/note/2355202

Can you for example see any missing images?

My Internet may have been a bit flaky at the time, but presumably it should retry?

Versions affected
SC 23.0-beta1 Android 9

enhancement

All 6 comments

According to the cleanup log, these two photos have never been activated. So, they were successfully uploaded but then StreetComplete did not call the backend to activate the pictures or failed to do so because of the flaky connection, more likely.

I figure it could make sense to retry once or twice if the activate call failed because of a timeout.

Sounds good. What's the algorithm for quest answers, I don't (think) I have issues with them, but perhaps I've only noticed this because its more obvious.

For anyone else in this scenario, this may recover your photos if they actually uploaded:
curl -d '{"osm_note_id": 2355202}' --verbose https://westnordost.de/streetcomplete/photo-upload/activate.php

I got:
{"found_photos":2,"activated_photos":0}

So I'm guessing they'd been expired elsewhere; indeed looks like they probably go after 24 hours. I don't know how tight your storage is, would it be worth bumping that expiry lifetime until this is fixed, so people can potentially recover them?

I think 24h is fine.

What's the algorithm for quest answers

It is tried once to upload them. If any fails (timeout), the whole upload fails. Quest answers that haven't been uploaded yet, are dropped.

Just kidding, quest answers that haven't been uploaded yet remain in local storage until such time as the upload was successful.

I think 24h is fine.

I just mean with this current issue 24 hours isn't necessarily enough time to check and realise an image hasn't uploaded (and hence save it). I often only action my notes after a day or two.

It is tried _once_ to upload them. If any fails (timeout), the whole upload fails.
quest answers that haven't been uploaded yet remain in local storage until such time as the upload was successful.

Could activation switch to the same model then (as it seems really rock solid for quests), I guess with a separate queue?

Could activation switch to the same model then (as it seems really rock solid for quests), I guess with a separate queue?

No, it can't. Each quest answer is uploaded in exactly one HTTPS request. Either it fails (timeout) or not. For note upload,

  • first each image is uploaded. If any of this fails, if I remember correctly, the whole note upload fails and must try again later (same as for quests)
  • then, the actual note is created / commented. Again, if this fails, the whole note upload fails and must try again later (same as for quests)
  • then, the photos are activated. If this fails, we cannot simply let the note upload fail because the note has already been posted publicly. This is why if the photo activation fails, it fails silently.

Could that not be considered as three separate processes though (or do the quest uploads happen in parallel)?

So when you add a note with photos it would add three or more things onto the note queue:
Upload note image 1
Upload note image n
Create note
Activate note images

Then if uploading the image failed, the whole lot would stop. If it succeeded but the note failed, it would retry the note next time, if both succeeded but it didn't activate, it would retry that next time, and hopefully within 24 hours.

Rather than just trying say twice, then silently failing to activate leaving a rather useless note.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nmxcgeo picture nmxcgeo  路  3Comments

ecksun picture ecksun  路  3Comments

rugk picture rugk  路  3Comments

Atrate picture Atrate  路  3Comments

MattWhilden picture MattWhilden  路  3Comments