From bba3bbd9f3e250cca0ce705e664382fe3ad6e78a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs=20Espino?= Date: Fri, 24 Aug 2018 09:53:44 +0200 Subject: MM-11572: Force correct order on messages generated in the bulk (#9244) --- app/import.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app/import.go') 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 +} -- cgit v1.2.3-1-g7c22