Skip to content

Acknowledgements support #2013

Closed
Closed

Description

@joy4eg

Hi,

We using parse-server and parse android SDK for our application.
Sometimes devices with our app loses the Internet connection (poor WiFi signal, or smth else) when request to create new object is running, and usually we get connection timeout error.
But, on server site object was successfully created and stored.
Later when interned connection will restored, we send request again and get objectId on device, AND get first object too.
It is commutation error, and now we have two same object with different objectId on server and on local application.

As workaround, each our object has localObjectId which generates on device, and in beforeSave trigger we remove same objects from database.

What i propose: add support of acknowledges, smth like this:

user ---> server: create new object instance of Foo
server ---> user: done, objectId: 42 (server creates a timer for 'thanks' message)
user --> server: thanks. Now server can safely save new object to database.

With this method we can safely and clearly avoid duplicates objects without overheads.
Comments are welcome.

Activity

  1. changed the title [-]acknowledges support[/-] [+]Acknowledgements support[/+] on Jun 9, 2016
  2. drew-gross commented on Jun 9, 2016

    @drew-gross
    Contributor

    Aside from the huge performance impact this would have, it wouldn't actually solve the problem, because what happens if the "thanks" message gets delayed, and only reaches the server after the timer has expired? The client would think the object has been saved, but really the server discarded it.

  3. joy4eg commented on Jun 9, 2016

    @joy4eg
    ContributorAuthor

    The client would think the object has been saved, but really the server discarded it.

    Yep, it's true ...

    Another, but much difficult way, is to add ability to generate objectId on the device side. I guess is will solve the problem, because with second request our object will updated not created.
    What do you think about it ?

  4. drew-gross commented on Jun 9, 2016

    @drew-gross
    Contributor

    That approach would have it's own issues. It's essentially what you've done with your localObjectId which does work, but doing it within parse would be changing every SDK. It would also mean we can't guarantee that object IDs are distributed evenly, as a malicious client could start sending non-evenly-distributed IDs. Some features we have planned rely on object IDs being evenly distributed, so I don't want to go with that approach.

    I think keeping your workaround is probably the best approach for now.

  5. flovilmart commented on Jul 13, 2016

    @flovilmart
    Contributor

    Closing due to lack of activity, please update to latest parse-server version and reopen if the issue persist.

    Don't forget to include your current:

    • node version
    • npm version
    • parse-server version
    • any relevant logs (VERBOSE=1 will enable verbose logging)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions