Migrate Jobs store to sync by default (#11183)
* Migrate Jobs store to sync by default * Fixing compilation * Fixing compilation * Fixing govet
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
bbdd6927de
Коммит
f934502a56
18
app/job.go
18
app/job.go
@@ -8,11 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func (a *App) GetJob(id string) (*model.Job, *model.AppError) {
|
||||
result := <-a.Srv.Store.Job().Get(id)
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
}
|
||||
return result.Data.(*model.Job), nil
|
||||
return a.Srv.Store.Job().Get(id)
|
||||
}
|
||||
|
||||
func (a *App) GetJobsPage(page int, perPage int) ([]*model.Job, *model.AppError) {
|
||||
@@ -20,11 +16,7 @@ func (a *App) GetJobsPage(page int, perPage int) ([]*model.Job, *model.AppError)
|
||||
}
|
||||
|
||||
func (a *App) GetJobs(offset int, limit int) ([]*model.Job, *model.AppError) {
|
||||
result := <-a.Srv.Store.Job().GetAllPage(offset, limit)
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
}
|
||||
return result.Data.([]*model.Job), nil
|
||||
return a.Srv.Store.Job().GetAllPage(offset, limit)
|
||||
}
|
||||
|
||||
func (a *App) GetJobsByTypePage(jobType string, page int, perPage int) ([]*model.Job, *model.AppError) {
|
||||
@@ -32,11 +24,7 @@ func (a *App) GetJobsByTypePage(jobType string, page int, perPage int) ([]*model
|
||||
}
|
||||
|
||||
func (a *App) GetJobsByType(jobType string, offset int, limit int) ([]*model.Job, *model.AppError) {
|
||||
result := <-a.Srv.Store.Job().GetAllByTypePage(jobType, offset, limit)
|
||||
if result.Err != nil {
|
||||
return nil, result.Err
|
||||
}
|
||||
return result.Data.([]*model.Job), nil
|
||||
return a.Srv.Store.Job().GetAllByTypePage(jobType, offset, limit)
|
||||
}
|
||||
|
||||
func (a *App) CreateJob(job *model.Job) (*model.Job, *model.AppError) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/store"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestGetJob(t *testing.T) {
|
||||
@@ -18,9 +18,8 @@ func TestGetJob(t *testing.T) {
|
||||
Id: model.NewId(),
|
||||
Status: model.NewId(),
|
||||
}
|
||||
if result := <-th.App.Srv.Store.Job().Save(status); result.Err != nil {
|
||||
t.Fatal(result.Err)
|
||||
}
|
||||
_, err := th.App.Srv.Store.Job().Save(status)
|
||||
require.Nil(t, err)
|
||||
|
||||
defer th.App.Srv.Store.Job().Delete(status.Id)
|
||||
|
||||
@@ -56,7 +55,8 @@ func TestGetJobByType(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, status := range statuses {
|
||||
store.Must(th.App.Srv.Store.Job().Save(status))
|
||||
_, err := th.App.Srv.Store.Job().Save(status)
|
||||
require.Nil(t, err)
|
||||
defer th.App.Srv.Store.Job().Delete(status.Id)
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user