Skip to content

big delta sync #68

Description

@lhyx

Hi,

Consider the following example:

$deltaPageRequest = $graph->createCollectionRequest('GET', '/me/mailFolders/[id]/messages/delta')
                                ->setPageSize(50)
                                ->setReturnType(Model\Message::class);
while (!$deltaPageRequest->isEnd()) {
                $items = $deltaPageRequest->getPage();
                 foreach ($items as $item) {
                              //do stuff
                 }
}

Here we sync the messages in a specific folder in the user's mailbox. This works fine but if there are a lot of messages in the folder some problems can occur. (I'm trying to sync 40000 messages)

If the access token expires while we are syncing this huge amount of messages we get a "InvalidAuthenticationToken" exception.

It's possible to catch this exception and set a new token for the graph object:

$graph->setAccessToken()

But you can't change the access token for the $deltaPageRequest.
So you can only create a new CollectionRequest and start again. But you also can't specify a start page for the CollectionRequest. So if we were syncing page 50 and we received the "InvalidAuthenticationToken" exception we can't recreate the $deltaPageRequest en start from page 50 and proceed. We have to start from page 1 again.

So what would be the best solution for this problem ? Change the GraphRequest class and make it possible to change the access token or change the GraphCollectionRequest class to specify the page for the first request ? Or is there a better solution ?

AB#7576

Metadata

Metadata

Labels

ADO to GitHub automation labelIssue caused by core project dependency modules or libraryP2A problem that needs to be fixed for the feature to function as intended as a priority 2cross-platformenhancementtracked

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions