fix token retrieval at first sync

master
lub 5 years ago
parent c138e2c1a3
commit 8ade0348eb

@ -432,13 +432,12 @@ function Get-FilterId {
return $filter_id return $filter_id
} }
function Start-MatrixSync { function Start-MatrixSync {
#get last used next_batch from account_data
$token = Get-NextBatchToken
#get /sync filter #get /sync filter
$filter_id = Get-FilterId $filter_id = Get-FilterId
Try { Try {
#get last used next_batch from account_data
$token = Get-NextBatchToken
#try first sync with the old token #try first sync with the old token
$token = Invoke-MatrixSync -Token $token -FilterId $filter_id $token = Invoke-MatrixSync -Token $token -FilterId $filter_id
} Catch { } Catch {
@ -447,9 +446,9 @@ function Start-MatrixSync {
} }
while($true) { while($true) {
$token = Invoke-MatrixSync -Token $token -FilterId $filter_id
#use $token of the previous sync #use $token of the previous sync
Set-NextBatchToken -Token $token Set-NextBatchToken -Token $token
$token = Invoke-MatrixSync -Token $token -FilterId $filter_id
} }
} }

Loading…
Cancel
Save