I have a question regarding which strategy DatoCMS applies.
Letâs say I have 2 different flows.
1 uses the CDA to users in real-time, the records in question are being fetched using DatoCMS pagination support. There are around 4000.
Meanwhile, another process is updating these records using CMA and could be adding/removing them.
What will happen to the users doing pagination? Is the pagination âawareâ of this and the âcursorâ remains intact or are we subject to possible duplicate results or results not being shown that should be?
There is no guarantee that the CDA will return the records you expect. Every time you run a query with a first and skip parameter, it runs the query and returns the results in real time. There is no âsnapshotâ of results from before the updates.
For example, if you have a:
A background process on a loop that adds 1 record a second
A CDA query thatâs fetching the first X records, skip Y (doesnât matter)
Then by default it will return the most recently updated/inserted X-Y records. Changing your orderBy will change the records returned, but still not in a âstaticâ way. Essentially, the CDA query doesnât have the concept of a frozen state or previous context; itâs just querying the latest information, whatever the latest in.
I am not sure what your use case here is, but if you need to guarantee some âatomicityâ of insertions/updates, such that the CDA will not return new data until ALL the updates are done, would one of these workarounds do the job?
If you need to update/publish more than 200 records at once, you could also consider using our environments for this, which allows you to make any edits you want in a separate sandbox, and then promote that sandbox to primary once itâs ready.