Skip to content
Snippets Groups Projects
Commit 1b4aa6e0 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Handle nil update callback

parent 04bec3a6
No related branches found
No related tags found
2 merge requests!231Revert "Update store to print changes to the partners list",!171RestoreContactsFromBackup
......@@ -87,6 +87,13 @@ func RestoreContactsFromBackup(backupPartnerIDs []byte, client *bindings.Client,
maxChanSize := 10000
restoreTimeout := time.Duration(30 * time.Second)
update := func(numFound, numRestored, total int, err string) {
if updatesCb != nil {
updatesCb.RestoreContactsCallback(numFound, numRestored,
total, err)
}
}
api := client.GetInternalClient()
store := stateStore{
......@@ -112,7 +119,7 @@ func RestoreContactsFromBackup(backupPartnerIDs []byte, client *bindings.Client,
}
// Before we start, report initial state
updatesCb.RestoreContactsCallback(lookupCnt, resetCnt, totalCnt, "")
update(lookupCnt, resetCnt, totalCnt, "")
// Initialize channels
chanSize := int(math.Min(float64(maxChanSize), float64(len(idList))))
......@@ -183,8 +190,7 @@ func RestoreContactsFromBackup(backupPartnerIDs []byte, client *bindings.Client,
if resetCnt == totalCnt {
done = true
}
updatesCb.RestoreContactsCallback(lookupCnt, resetCnt, totalCnt,
"")
update(lookupCnt, resetCnt, totalCnt, "")
}
// Cleanup
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment