Slate TypeScript - return largest number - BEFORE build

Viewed 41

related to question: Slate - TypeScript - return the required info out of a promise

Edits and Object search Changes to objects and links are propagated to the Objects.search() APIs after your function has finished executing. This means that Objects.search() APIs will use the old objects, properties and links. As a result, search, filtering, search arounds, and aggregations may not reflect the edits to the Ontology, including creation and deletion. Your function will need to handle this case manually.

In my case: if i receive the largest number, build new one +1 it only works one time.

Any ideas (best WITH code) how to solve this, to get always the newest data (not build)?

1 Answers

What you are describing is a problem called Distributed System Consistency. Whenever you perform a write operation on a distributed system, you only write to one node, it then gets propagated to other nodes. Depending on the size of your cluster this can be almost instant or go from a handful of seconds to a longer time.

When you are performing a read operation immediately after your write, you may read it from any of the nodes in the system. Thus it can happen that you are reading from a node that isn't updated yet.

In the case of ontology writes and reads, it can take couple of seconds all nodes to take the newer changes. The way for you to fix your code would be to have a small delay between the write and the read.

You can read more on Eventual Consistency here https://en.wikipedia.org/wiki/Eventual_consistency.

Related