SyncStateNotFound error: how to fix or avoid?

2020-06-23 09:11发布

I am using Microsoft Graph API delta queries for downloading some information (messages, contacts, events) regularly. But sometimes I get this error:

{
    "error" :
    {
        "code" : "SyncStateNotFound",
        "innerError" :
        {
            "date" : "2018-06-01T06:31:24",
            "request-id" : "47e918a9-ce5b-42b4-8a86-12b96c93121a"
        },
        "message" : "The sync state generation is not found; generation=605;[highest=841][841][839][840]."
    }
}

I can't provide you steps for reproducing because I don't know how to reproduce it. It happens sometimes on production environment.

So I have some questions:

  1. What is generation in Microsoft Graph API? Is there any available documentation about it? I didn't find anything useful in the Internet.
  2. Why delta links expire? Delta link expires by time or some iterations of using delta links? Can I save my delta link in my database and in a e.g. 1 year use this delta link for syncing again?
  3. How to avoid delta links expiration? Are there any lifehacks?
  4. What should I do if I got this issue? Full resync and getting new delta link?
  5. Is it a bug or feature?

1条回答
等我变得足够好
2楼-- · 2020-06-23 09:40

Every time you sync, a new sync token is generated. We store the current sync token along with the two previous ones. This helps us in cases where we advance the sync on the server side, but something happens transmitting the data to the client so they don't get the new token value. In such cases, we can "fallback" to the previous sync token so that the client doesn't have to resync everything. But these three stored tokens change with each sync - the oldest one gets dropped and we advance. In your case, you are passing us a delta token that is around 230 generations old. That token is long gone.

Another thing to consider is that an "inactive" sync token will hang around for around 90 days at which point we consider it stale, pour gas on it and set it on fire (not really).

查看更多
登录 后发表回答