Coder Social home page Coder Social logo

Comments (2)

ssrihari avatar ssrihari commented on May 14, 2024

Further thoughts:

  • We should store updated_on_server_at during the POST request, so that we can compute the diff of records to send to each device during the sync.
  • Sync all records first time. First time syncing should be indicated by absence of updated_on_server_at or a more specific field in the request.
  • We should separate the notions of request and response timestamps from updated_at timestamps of the records. To compute the diff, we should only ever use timestamps of records, not request/response timestamps.
  • At the end of the GET request, we should compute the latest_record_timestamp, and send that to the device with the response. The device can send this value with the next request to receive the next batch of records. This makes the pulls batch-able as a stream of independent requests, without needing to keep a track of when the sync 'ends'. Do not use last_sync_at for this reason.

Things the device/front-end should do:

  • Devices should store latest_record_updated_at per API endpoint.
  • Devices should send a value denoting the number of records, or batch_size they want. This can change per request.
  • Devices should push before they pull

Things we're not doing right now:

  • If we want to send back only the diff of changed records per user, we should store last_updated_by_user_id
  • If we use last_sync_at, it should be set at the beginning of the GET request, not the end.
  • We could include a margin of error in the time range we use to retrieve records to sync, to account for some race conditions or time differences across devices/servers.

Patterns for office mobile syncing architecture: https://www.dre.vanderbilt.edu/~schmidt/PDF/PatternPaperv11.pdf

from simple-android.

ssrihari avatar ssrihari commented on May 14, 2024

@timcheadle: @govindkrjoshi and I are in agreement about the above. Thoughts?

from simple-android.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.