Sync elasticsearch on connection with database - nodeJS

前端 未结 1 1439
暖寄归人
暖寄归人 2021-01-24 02:07

Aim: sync elasticsearch with postgres database
Why: sometimes newtwork or cluster/server break so future updates should be recorded

相关标签:
1条回答
  • 2021-01-24 02:54

    For 1: As it is you have not warranty that syncProcess will have run by the time the client is exported. Instead you should do something like in this answer and export a promise instead.

    For 2: With the solution I linked to in the above question, this would be taken care of.

    For 3: An updates table would also catch record deletions, while simply selecting from the DB would not, since you don't know which records have disappeared.

    For 4: The second comment after the article you linked to provides the answer (hint: timestamps are not strictly monotonic).

    0 讨论(0)
提交回复
热议问题