Assuming:
- I add rapidly via the API call 4 short notes for the same notecard
- the destination notecard is not moving, in continuous mode with fair connectivity to the network
On the notehub I see the notes for the .qi files added in the correct order
Could you discuss in which situations (if at all possible), the notes would arrive in a chronologically different order at the notecard?
Second twist to the question:
- if note 1 goes to queueA.qi, note 2 to queueB.qi, note 3 to queueA.qi
Is there a different answer if the notes are destined for different files?
Now I realize there are timestamps I might be able to use, but why bother if the exceptions to FIFO are extremely rare.
Thank you!
Hey @Francois sorry that this question fell through the cracks over the weekend. Let me confirm my assumptions with the Notehub team before answering, just to make sure I don’t give you the wrong info.
Hey @Francois, just FYI I tweaked your title since the substance of the question is about inbound notes from some service through Notehub.io to a Notecard.
The answer to your question is somewhat dependent on how fast your service is sending Notes to Notehub using the API. When an inbound Note shows up, we give it a modified time down to a 1-second resolution, so if you are sending Notes less often than this, you should be ok. More frequently than 1-sec, and you won’t have enough resolution on the modified time to know for sure.
In terms of how they are delivered to your host when performing a note.get
, Notes are delivered in FIFO-style (oldest first) using the modified timestamp above.
At the end of the day, we make reasonable attempts to order notes, but if you absolutely need inbound notes to always show up in the order they are added, you’ll need to add sequencing fields and logic on the host side.
@bsatrom Thank you for the detailed answer. In short, I’ll tag on a time.sleep(2) after each note inbound or outbound and “sleep” better myself!