Make uploading skipped history entries more efficient and use only one HTTP request

This commit is contained in:
David Dworken 2022-10-09 17:13:40 -07:00
parent c16d260643
commit 9bfd4bf173

View File

@ -263,8 +263,7 @@ func maybeUploadSkippedHistoryEntries(ctx *context.Context) error {
return fmt.Errorf("failed to retrieve history entries that haven't been uploaded yet: %v", err) return fmt.Errorf("failed to retrieve history entries that haven't been uploaded yet: %v", err)
} }
hctx.GetLogger().Printf("Uploading %d history entries that previously failed to upload (query=%#v)\n", len(entries), query) hctx.GetLogger().Printf("Uploading %d history entries that previously failed to upload (query=%#v)\n", len(entries), query)
for _, entry := range entries { jsonValue, err := lib.EncryptAndMarshal(config, entries)
jsonValue, err := lib.EncryptAndMarshal(config, []*data.HistoryEntry{entry})
if err != nil { if err != nil {
return err return err
} }
@ -273,7 +272,6 @@ func maybeUploadSkippedHistoryEntries(ctx *context.Context) error {
// Failed to upload the history entry, so we must still be offline. So just return nil and we'll try again later. // Failed to upload the history entry, so we must still be offline. So just return nil and we'll try again later.
return nil return nil
} }
}
// Mark down that we persisted it // Mark down that we persisted it
config.HaveMissedUploads = false config.HaveMissedUploads = false