Cht-core: IDs of new documents are not added to changes requests until page refresh

Created on 19 Feb 2018  路  6Comments  路  Source: medic/cht-core

To replicate:

  • Open a restricted user, watch the network. You should generate a longpoll _change request once everything is synced.
  • Create a new document. Note that a bunch of stuff happens on the network, but specifically that the first longpoll is satisfied by the document you just created, and a new longpoll is created after this.

    • Do that a few more times for good effect.

What should happen:

  • Every time a new longpoll request is initiated after you write a document, the id of that document should be among the ids passed

What actually happens:

  • The ids are the same each time.
  • If you refresh the longpoll that is initiated after this has the correct doc ids.

Looking at the code this is actually obvious: we only add the doc_ids when we're instantiating the two way sync the first time.

Bug Duplicate

Most helpful comment

Well I think ideally we'd fix this implicitly by redesigning the replication API so we don't have to know the ids at all, see: #4185

If we can't fix that particular oddity in the algorithm we should look into this.

All 6 comments

I updated the description

Hi @abbyad,

Please ensure this ticket has a Priority, Status and Type label.

(See triaging old issues for more detail)

Redirecting to @alxndrsn to put the type Status and Priority

I'd guess this is low priority, as:

  • deleting documents that have just been created by a different user probably isn't that common. But perhaps deletes aren't reaching all phones used in training?
  • fixing it looks fiddly

Thoughts, @garethbowen @SCdF?

Well I think ideally we'd fix this implicitly by redesigning the replication API so we don't have to know the ids at all, see: #4185

If we can't fix that particular oddity in the algorithm we should look into this.

We no longer include doc ids in the request so this is fixed.

Was this page helpful?
0 / 5 - 0 ratings