diff options
author | Jesús Espino <jespinog@gmail.com> | 2018-08-24 09:53:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-24 09:53:44 +0200 |
commit | bba3bbd9f3e250cca0ce705e664382fe3ad6e78a (patch) | |
tree | 63b8e40450634949d6bc3f80346cd26b7639c49d /app/import.go | |
parent | 8bbee74ed811e7aa8167ad7cea6d05042a90f446 (diff) | |
download | chat-bba3bbd9f3e250cca0ce705e664382fe3ad6e78a.tar.gz chat-bba3bbd9f3e250cca0ce705e664382fe3ad6e78a.tar.bz2 chat-bba3bbd9f3e250cca0ce705e664382fe3ad6e78a.zip |
MM-11572: Force correct order on messages generated in the bulk (#9244)
Diffstat (limited to 'app/import.go')
-rw-r--r-- | app/import.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/app/import.go b/app/import.go index 078198dd4..496c6b7fc 100644 --- a/app/import.go +++ b/app/import.go @@ -100,6 +100,10 @@ func (a *App) BulkImport(fileReader io.Reader, dryRun bool, workers int) (*model return model.NewAppError("BulkImport", "app.import.bulk_import.file_scan.error", nil, err.Error(), http.StatusInternalServerError), 0 } + if err := a.finalizeImport(dryRun); err != nil { + return err, 0 + } + return nil, 0 } @@ -165,3 +169,14 @@ func (a *App) ImportLine(line LineImportData, dryRun bool) *model.AppError { return model.NewAppError("BulkImport", "app.import.import_line.unknown_line_type.error", map[string]interface{}{"Type": line.Type}, "", http.StatusBadRequest) } } + +func (a *App) finalizeImport(dryRun bool) *model.AppError { + if dryRun { + return nil + } + result := <-a.Srv.Store.Channel().ResetLastPostAt() + if result.Err != nil { + return result.Err + } + return nil +} |