diff --git a/api4/handlers.go b/api4/handlers.go index a43fb1de71..45d1f5cc74 100644 --- a/api4/handlers.go +++ b/api4/handlers.go @@ -209,3 +209,24 @@ func requireLicense(f handlerFunc) handlerFunc { f(c, w, r) } } + +func minimumProfessionalLicense(f handlerFunc) handlerFunc { + return func(c *Context, w http.ResponseWriter, r *http.Request) { + lic := c.App.Srv().License() + if lic == nil || (lic.SkuShortName != model.LicenseShortSkuProfessional && lic.SkuShortName != model.LicenseShortSkuEnterprise) { + c.Err = model.NewAppError("", "api.license_error.professional_or_enterprise", nil, "", http.StatusNotImplemented) + return + } + f(c, w, r) + } +} + +func rejectGuests(f handlerFunc) handlerFunc { + return func(c *Context, w http.ResponseWriter, r *http.Request) { + if c.AppContext.Session().Props[model.SessionPropIsGuest] == "true" { + c.Err = model.NewAppError("", "api.authorization_error.guest", nil, "", http.StatusNotImplemented) + return + } + f(c, w, r) + } +} diff --git a/api4/insights.go b/api4/insights.go index a7f4828d14..3bcedecb70 100644 --- a/api4/insights.go +++ b/api4/insights.go @@ -6,18 +6,20 @@ package api4 import ( "encoding/json" "net/http" + "time" + "github.com/mattermost/mattermost-server/v6/app" "github.com/mattermost/mattermost-server/v6/model" ) func (api *API) InitInsights() { // Reactions - api.BaseRoutes.InsightsForTeam.Handle("/reactions", api.APISessionRequired(getTopReactionsForTeamSince)).Methods("GET") - api.BaseRoutes.InsightsForUser.Handle("/reactions", api.APISessionRequired(getTopReactionsForUserSince)).Methods("GET") + api.BaseRoutes.InsightsForTeam.Handle("/reactions", api.APISessionRequired(minimumProfessionalLicense(rejectGuests(getTopReactionsForTeamSince)))).Methods("GET") + api.BaseRoutes.InsightsForUser.Handle("/reactions", api.APISessionRequired(minimumProfessionalLicense(rejectGuests(getTopReactionsForUserSince)))).Methods("GET") // Channels - api.BaseRoutes.InsightsForTeam.Handle("/channels", api.APISessionRequired(getTopChannelsForTeamSince)).Methods("GET") - api.BaseRoutes.InsightsForUser.Handle("/channels", api.APISessionRequired(getTopChannelsForUserSince)).Methods("GET") + api.BaseRoutes.InsightsForTeam.Handle("/channels", api.APISessionRequired(minimumProfessionalLicense(rejectGuests(getTopChannelsForTeamSince)))).Methods("GET") + api.BaseRoutes.InsightsForUser.Handle("/channels", api.APISessionRequired(minimumProfessionalLicense(rejectGuests(getTopChannelsForUserSince)))).Methods("GET") } // Top Reactions @@ -39,14 +41,16 @@ func getTopReactionsForTeamSince(c *Context, w http.ResponseWriter, r *http.Requ return } - startTime, err := model.GetStartUnixMilliForTimeRange(c.Params.TimeRange) + user, err := c.App.GetUser(c.AppContext.Session().UserId) if err != nil { c.Err = err return } + startTime := model.StartOfDayForTimeRange(c.Params.TimeRange, user.GetTimezoneLocation()) + topReactionList, err := c.App.GetTopReactionsForTeamSince(c.Params.TeamId, c.AppContext.Session().UserId, &model.InsightsOpts{ - StartUnixMilli: startTime, + StartUnixMilli: startTime.UnixMilli(), Page: c.Params.Page, PerPage: c.Params.PerPage, }) @@ -86,14 +90,16 @@ func getTopReactionsForUserSince(c *Context, w http.ResponseWriter, r *http.Requ } } - startTime, err := model.GetStartUnixMilliForTimeRange(c.Params.TimeRange) + user, err := c.App.GetUser(c.AppContext.Session().UserId) if err != nil { c.Err = err return } + startTime := model.StartOfDayForTimeRange(c.Params.TimeRange, user.GetTimezoneLocation()) + topReactionList, err := c.App.GetTopReactionsForUserSince(c.AppContext.Session().UserId, c.Params.TeamId, &model.InsightsOpts{ - StartUnixMilli: startTime, + StartUnixMilli: startTime.UnixMilli(), Page: c.Params.Page, PerPage: c.Params.PerPage, }) @@ -130,14 +136,17 @@ func getTopChannelsForTeamSince(c *Context, w http.ResponseWriter, r *http.Reque return } - startTime, err := model.GetStartUnixMilliForTimeRange(c.Params.TimeRange) + user, err := c.App.GetUser(c.AppContext.Session().UserId) if err != nil { c.Err = err return } + loc := user.GetTimezoneLocation() + startTime := model.StartOfDayForTimeRange(c.Params.TimeRange, loc) + topChannels, err := c.App.GetTopChannelsForTeamSince(c.Params.TeamId, c.AppContext.Session().UserId, &model.InsightsOpts{ - StartUnixMilli: startTime, + StartUnixMilli: startTime.UnixMilli(), Page: c.Params.Page, PerPage: c.Params.PerPage, }) @@ -146,6 +155,12 @@ func getTopChannelsForTeamSince(c *Context, w http.ResponseWriter, r *http.Reque return } + topChannels.PostCountByDuration, err = postCountByDurationViewModel(c.App, topChannels, startTime, c.Params.TimeRange, nil, loc) + if err != nil { + c.Err = err + return + } + js, jsonErr := json.Marshal(topChannels) if jsonErr != nil { c.Err = model.NewAppError("getTopChannelsForTeamSince", "api.marshal_error", nil, jsonErr.Error(), http.StatusInternalServerError) @@ -177,14 +192,17 @@ func getTopChannelsForUserSince(c *Context, w http.ResponseWriter, r *http.Reque } } - startTime, err := model.GetStartUnixMilliForTimeRange(c.Params.TimeRange) + user, err := c.App.GetUser(c.AppContext.Session().UserId) if err != nil { c.Err = err return } + loc := user.GetTimezoneLocation() + startTime := model.StartOfDayForTimeRange(c.Params.TimeRange, loc) + topChannels, err := c.App.GetTopChannelsForUserSince(c.AppContext.Session().UserId, c.Params.TeamId, &model.InsightsOpts{ - StartUnixMilli: startTime, + StartUnixMilli: startTime.UnixMilli(), Page: c.Params.Page, PerPage: c.Params.PerPage, }) @@ -194,6 +212,12 @@ func getTopChannelsForUserSince(c *Context, w http.ResponseWriter, r *http.Reque return } + topChannels.PostCountByDuration, err = postCountByDurationViewModel(c.App, topChannels, startTime, c.Params.TimeRange, &c.AppContext.Session().UserId, loc) + if err != nil { + c.Err = err + return + } + js, jsonErr := json.Marshal(topChannels) if jsonErr != nil { c.Err = model.NewAppError("getTopChannelsForUserSince", "api.marshal_error", nil, jsonErr.Error(), http.StatusInternalServerError) @@ -202,3 +226,23 @@ func getTopChannelsForUserSince(c *Context, w http.ResponseWriter, r *http.Reque w.Write(js) } + +// postCountByDurationViewModel expects a list of channels that are pre-authorized for the given user to view. +func postCountByDurationViewModel(app app.AppIface, topChannelList *model.TopChannelList, startTime *time.Time, timeRange string, userID *string, location *time.Location) (model.ChannelPostCountByDuration, *model.AppError) { + if len(topChannelList.Items) == 0 { + return nil, nil + } + var postCountsByDay []*model.DurationPostCount + channelIDs := topChannelList.ChannelIDs() + var grouping model.PostCountGrouping + if timeRange == model.TimeRangeToday { + grouping = model.PostsByHour + } else { + grouping = model.PostsByDay + } + postCountsByDay, err := app.PostCountsByDuration(channelIDs, startTime.UnixMilli(), userID, grouping, location) + if err != nil { + return nil, err + } + return model.ToDailyPostCountViewModel(postCountsByDay, startTime, model.TimeRangeToNumberDays(timeRange), channelIDs), nil +} diff --git a/api4/insights_test.go b/api4/insights_test.go index b936cb8be7..58457e8b38 100644 --- a/api4/insights_test.go +++ b/api4/insights_test.go @@ -21,6 +21,7 @@ func TestGetTopReactionsForTeamSince(t *testing.T) { th.ConfigStore.SetReadOnlyFF(false) defer th.ConfigStore.SetReadOnlyFF(true) th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true }) + th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuProfessional)) client := th.Client @@ -246,6 +247,7 @@ func TestGetTopReactionsForUserSince(t *testing.T) { th.ConfigStore.SetReadOnlyFF(false) defer th.ConfigStore.SetReadOnlyFF(true) th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true }) + th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuProfessional)) client := th.Client @@ -437,6 +439,7 @@ func TestGetTopChannelsForTeamSince(t *testing.T) { th.ConfigStore.SetReadOnlyFF(false) defer th.ConfigStore.SetReadOnlyFF(true) th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true }) + th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuProfessional)) client := th.Client userId := th.BasicUser.Id @@ -485,6 +488,10 @@ func TestGetTopChannelsForTeamSince(t *testing.T) { require.NoError(t, err) assert.Equal(t, channel6.Id, topChannels.Items[0].ID) assert.Equal(t, int64(1), topChannels.Items[0].MessageCount) + + t.Run("has post count by day", func(t *testing.T) { + require.NotNil(t, topChannels.PostCountByDuration) + }) }) t.Run("get-top-channels-for-user-since exclude channels user is not member of", func(t *testing.T) { @@ -531,6 +538,7 @@ func TestGetTopChannelsForUserSince(t *testing.T) { th.ConfigStore.SetReadOnlyFF(false) defer th.ConfigStore.SetReadOnlyFF(true) th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true }) + th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuProfessional)) client := th.Client userId := th.BasicUser.Id @@ -579,6 +587,10 @@ func TestGetTopChannelsForUserSince(t *testing.T) { require.NoError(t, err) assert.Equal(t, channel6.Id, topChannels.Items[0].ID) assert.Equal(t, int64(1), topChannels.Items[0].MessageCount) + + t.Run("has post count by day", func(t *testing.T) { + require.NotNil(t, topChannels.PostCountByDuration) + }) }) t.Run("get-top-channels-for-user-since invalid team id", func(t *testing.T) { diff --git a/app/app_iface.go b/app/app_iface.go index 28f6e34bda..ac8461ea26 100644 --- a/app/app_iface.go +++ b/app/app_iface.go @@ -262,6 +262,12 @@ type AppIface interface { // PopulateWebConnConfig checks if the connection id already exists in the hub, // and if so, accordingly populates the other fields of the webconn. PopulateWebConnConfig(s *model.Session, cfg *WebConnConfig, seqVal string) (*WebConnConfig, error) + // PostCountsByDuration returns the post counts for the given channels, grouped by day, starting at the given time. + // Unless one is specifically itending to omit results from part of the calendar day, it will typically makes the most sense to + // use a sinceUnixMillis parameter value as returned by model.GetStartOfDayMillis. + // + // WARNING: PostCountsByDuration PERFORMS NO AUTHORIZATION CHECKS ON THE GIVEN CHANNELS. + PostCountsByDuration(channelIDs []string, sinceUnixMillis int64, userID *string, grouping model.PostCountGrouping, groupingLocation *time.Location) ([]*model.DurationPostCount, *model.AppError) // PromoteGuestToUser Convert user's roles and all his membership's roles from // guest roles to regular user roles. PromoteGuestToUser(c *request.Context, user *model.User, requestorId string) *model.AppError diff --git a/app/channel.go b/app/channel.go index fd05d8ba13..ad78141260 100644 --- a/app/channel.go +++ b/app/channel.go @@ -10,6 +10,7 @@ import ( "fmt" "net/http" "strings" + "time" "github.com/mattermost/mattermost-server/v6/app/request" "github.com/mattermost/mattermost-server/v6/model" @@ -3417,3 +3418,19 @@ func (a *App) GetTopChannelsForUserSince(userID, teamID string, opts *model.Insi } return topChannels, nil } + +// PostCountsByDuration returns the post counts for the given channels, grouped by day, starting at the given time. +// Unless one is specifically itending to omit results from part of the calendar day, it will typically makes the most sense to +// use a sinceUnixMillis parameter value as returned by model.GetStartOfDayMillis. +// +// WARNING: PostCountsByDuration PERFORMS NO AUTHORIZATION CHECKS ON THE GIVEN CHANNELS. +func (a *App) PostCountsByDuration(channelIDs []string, sinceUnixMillis int64, userID *string, grouping model.PostCountGrouping, groupingLocation *time.Location) ([]*model.DurationPostCount, *model.AppError) { + if !a.Config().FeatureFlags.InsightsEnabled { + return nil, model.NewAppError("PostCountsByDuration", "api.insights.feature_disabled", nil, "", http.StatusNotImplemented) + } + postCountByDay, err := a.Srv().Store.Channel().PostCountsByDuration(channelIDs, sinceUnixMillis, userID, grouping, groupingLocation) + if err != nil { + return nil, model.NewAppError("PostCountsByDuration", "app.channel.get_post_count_by_day.app_error", nil, err.Error(), http.StatusInternalServerError) + } + return postCountByDay, nil +} diff --git a/app/channel_test.go b/app/channel_test.go index 2fd3506996..4e6b37506b 100644 --- a/app/channel_test.go +++ b/app/channel_test.go @@ -13,6 +13,7 @@ import ( "strings" "sync" "testing" + "time" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" @@ -2418,10 +2419,10 @@ func TestGetTopChannelsForTeamSince(t *testing.T) { {ID: channel5.Id, MessageCount: 2}, } - timeRange, _ := model.GetStartUnixMilliForTimeRange(model.TimeRangeToday) + timeRange := model.StartOfDayForTimeRange(model.TimeRangeToday, time.Now().Location()) t.Run("get-top-channels-for-team-since", func(t *testing.T) { - topChannels, err := th.App.GetTopChannelsForTeamSince(th.BasicChannel.TeamId, th.BasicUser.Id, &model.InsightsOpts{StartUnixMilli: timeRange, Page: 0, PerPage: 5}) + topChannels, err := th.App.GetTopChannelsForTeamSince(th.BasicChannel.TeamId, th.BasicUser.Id, &model.InsightsOpts{StartUnixMilli: timeRange.UnixMilli(), Page: 0, PerPage: 5}) require.Nil(t, err) for i, channel := range topChannels.Items { @@ -2429,7 +2430,7 @@ func TestGetTopChannelsForTeamSince(t *testing.T) { assert.Equal(t, expectedTopChannels[i].MessageCount, channel.MessageCount) } - topChannels, err = th.App.GetTopChannelsForTeamSince(th.BasicChannel.TeamId, th.BasicUser.Id, &model.InsightsOpts{StartUnixMilli: timeRange, Page: 1, PerPage: 5}) + topChannels, err = th.App.GetTopChannelsForTeamSince(th.BasicChannel.TeamId, th.BasicUser.Id, &model.InsightsOpts{StartUnixMilli: timeRange.UnixMilli(), Page: 1, PerPage: 5}) require.Nil(t, err) assert.Equal(t, channel6.Id, topChannels.Items[0].ID) assert.Equal(t, int64(1), topChannels.Items[0].MessageCount) @@ -2476,10 +2477,10 @@ func TestGetTopChannelsForUserSince(t *testing.T) { {ID: channel5.Id, MessageCount: 2}, } - timeRange, _ := model.GetStartUnixMilliForTimeRange(model.TimeRangeToday) + timeRange := model.StartOfDayForTimeRange(model.TimeRangeToday, time.Now().Location()) t.Run("get-top-channels-for-user-since", func(t *testing.T) { - topChannels, err := th.App.GetTopChannelsForUserSince(th.BasicUser.Id, "", &model.InsightsOpts{StartUnixMilli: timeRange, Page: 0, PerPage: 5}) + topChannels, err := th.App.GetTopChannelsForUserSince(th.BasicUser.Id, "", &model.InsightsOpts{StartUnixMilli: timeRange.UnixMilli(), Page: 0, PerPage: 5}) require.Nil(t, err) for i, channel := range topChannels.Items { @@ -2487,9 +2488,132 @@ func TestGetTopChannelsForUserSince(t *testing.T) { assert.Equal(t, expectedTopChannels[i].MessageCount, channel.MessageCount) } - topChannels, err = th.App.GetTopChannelsForUserSince(th.BasicUser.Id, th.BasicChannel.TeamId, &model.InsightsOpts{StartUnixMilli: timeRange, Page: 1, PerPage: 5}) + topChannels, err = th.App.GetTopChannelsForUserSince(th.BasicUser.Id, th.BasicChannel.TeamId, &model.InsightsOpts{StartUnixMilli: timeRange.UnixMilli(), Page: 1, PerPage: 5}) require.Nil(t, err) assert.Equal(t, channel6.Id, topChannels.Items[0].ID) assert.Equal(t, int64(1), topChannels.Items[0].MessageCount) }) } + +func TestPostCountsByDuration(t *testing.T) { + th := Setup(t).InitBasic() + defer th.TearDown() + + th.Server.configStore.SetReadOnlyFF(false) + defer th.Server.configStore.SetReadOnlyFF(true) + th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = true }) + + channel2 := th.CreateChannel(th.BasicTeam) + channel3 := th.CreatePrivateChannel(th.BasicTeam) + channel4 := th.CreatePrivateChannel(th.BasicTeam) + channel5 := th.CreateChannel(th.BasicTeam) + channel6 := th.CreatePrivateChannel(th.BasicTeam) + defer func() { + th.App.PermanentDeleteChannel(channel2) + th.App.PermanentDeleteChannel(channel3) + th.App.PermanentDeleteChannel(channel4) + th.App.PermanentDeleteChannel(channel5) + th.App.PermanentDeleteChannel(channel6) + }() + th.AddUserToChannel(th.BasicUser, channel2) + th.AddUserToChannel(th.BasicUser, channel3) + th.AddUserToChannel(th.BasicUser, channel4) + th.AddUserToChannel(th.BasicUser, channel5) + th.AddUserToChannel(th.BasicUser, channel6) + + channels := [6]*model.Channel{th.BasicChannel, channel2, channel3, channel4, channel5, channel6} + channelIDs := []string{th.BasicChannel.Id, channel2.Id, channel3.Id, channel4.Id, channel5.Id, channel6.Id} + + i := len(channels) + for ci, channel := range channels { + for j := i; j > 0; j-- { + d1 := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC).AddDate(0, 0, ci) + d2 := time.Date(2009, time.November, 10, 9, 0, 0, 0, time.UTC).AddDate(0, 0, ci) + _, err := th.App.CreatePost(th.Context, &model.Post{ + UserId: th.BasicUser.Id, + ChannelId: channel.Id, + CreateAt: d1.Unix() * 1000, + }, channel, false, false) + require.Nil(t, err) + _, err = th.App.CreatePost(th.Context, &model.Post{ + UserId: th.BasicUser2.Id, + ChannelId: channel.Id, + CreateAt: d2.Unix() * 1000, + }, channel, false, false) + require.Nil(t, err) + } + i-- + } + + expectedDayGrouping := map[string]map[string]int{ + "2009-11-10": { + th.BasicChannel.Id: 6, + }, + "2009-11-11": { + channel2.Id: 5, + }, + "2009-11-12": { + channel3.Id: 4, + }, + "2009-11-13": { + channel4.Id: 3, + }, + "2009-11-14": { + channel5.Id: 2, + }, + "2009-11-15": { + channel6.Id: 1, + }, + } + + expectedHourGrouping := map[string]map[string]int{ + "2009-11-15T09": { + channel6.Id: 1, + }, + "2009-11-15T23": { + channel6.Id: 1, + }, + } + + sinceUnixMillis := time.Date(2009, time.November, 9, 23, 0, 0, 0, time.UTC).UnixMilli() + + t.Run("get-post-counts-by-day scoped by user, grouped by day", func(t *testing.T) { + dailyPostCount, err := th.App.PostCountsByDuration(channelIDs, sinceUnixMillis, &th.BasicUser.Id, model.PostsByDay, time.Now().UTC().Location()) + require.Nil(t, err) + require.GreaterOrEqual(t, len(dailyPostCount), 6) + + for _, item := range dailyPostCount { + if strings.HasPrefix(item.Duration, "2009") { + expectedCount := expectedDayGrouping[item.Duration][item.ChannelID] + assert.Equal(t, expectedCount, item.PostCount) + } + } + }) + + t.Run("get-post-counts-by-day all users, grouped by day", func(t *testing.T) { + dailyPostCount, err := th.App.PostCountsByDuration(channelIDs, sinceUnixMillis, nil, model.PostsByDay, time.Now().UTC().Location()) + require.Nil(t, err) + require.GreaterOrEqual(t, len(dailyPostCount), 6) + + for _, item := range dailyPostCount { + if strings.HasPrefix(item.Duration, "2009") { + expectedCount := expectedDayGrouping[item.Duration][item.ChannelID] + assert.Equal(t, expectedCount*2, item.PostCount) + } + } + }) + + t.Run("get-post-counts-by-day all users, grouped by hour", func(t *testing.T) { + oneDaySince := time.Date(2009, time.November, 14, 23, 0, 0, 0, time.UTC).UnixMilli() + dailyPostCount, err := th.App.PostCountsByDuration(channelIDs, oneDaySince, nil, model.PostsByHour, time.Now().UTC().Location()) + require.Nil(t, err) + require.GreaterOrEqual(t, len(dailyPostCount), 1) + + for _, item := range dailyPostCount { + if strings.HasPrefix(item.Duration, "2009") { + expectedCount := expectedHourGrouping[item.Duration][item.ChannelID] + assert.Equal(t, expectedCount, item.PostCount) + } + } + }) +} diff --git a/app/opentracing/opentracing_layer.go b/app/opentracing/opentracing_layer.go index 39dcd31510..4c521dc204 100644 --- a/app/opentracing/opentracing_layer.go +++ b/app/opentracing/opentracing_layer.go @@ -12654,6 +12654,28 @@ func (a *OpenTracingAppLayer) PostAddToChannelMessage(c *request.Context, user * return resultVar0 } +func (a *OpenTracingAppLayer) PostCountsByDuration(channelIDs []string, sinceUnixMillis int64, userID *string, grouping model.PostCountGrouping, groupingLocation *time.Location) ([]*model.DurationPostCount, *model.AppError) { + origCtx := a.ctx + span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.PostCountsByDuration") + + a.ctx = newCtx + a.app.Srv().Store.SetContext(newCtx) + defer func() { + a.app.Srv().Store.SetContext(origCtx) + a.ctx = origCtx + }() + + defer span.Finish() + resultVar0, resultVar1 := a.app.PostCountsByDuration(channelIDs, sinceUnixMillis, userID, grouping, groupingLocation) + + if resultVar1 != nil { + span.LogFields(spanlog.Error(resultVar1)) + ext.Error.Set(span, true) + } + + return resultVar0, resultVar1 +} + func (a *OpenTracingAppLayer) PostPatchWithProxyRemovedFromImageURLs(patch *model.PostPatch) *model.PostPatch { origCtx := a.ctx span, newCtx := tracing.StartSpanWithParentByContext(a.ctx, "app.PostPatchWithProxyRemovedFromImageURLs") diff --git a/app/reaction_test.go b/app/reaction_test.go index a9ad612a2e..1b13f97f3c 100644 --- a/app/reaction_test.go +++ b/app/reaction_test.go @@ -231,10 +231,10 @@ func TestGetTopReactionsForTeamSince(t *testing.T) { expectedTopReactions[3] = &model.TopReaction{EmojiName: "sad", Count: int64(3)} expectedTopReactions[4] = &model.TopReaction{EmojiName: "happy", Count: int64(2)} - timeRange, _ := model.GetStartUnixMilliForTimeRange(model.TimeRangeToday) + timeRange := model.StartOfDayForTimeRange(model.TimeRangeToday, time.Now().Location()) t.Run("get-top-reactions-for-team-since", func(t *testing.T) { - topReactions, err := th.App.GetTopReactionsForTeamSince(teamId, userId, &model.InsightsOpts{StartUnixMilli: timeRange, Page: 0, PerPage: 5}) + topReactions, err := th.App.GetTopReactionsForTeamSince(teamId, userId, &model.InsightsOpts{StartUnixMilli: timeRange.UnixMilli(), Page: 0, PerPage: 5}) require.Nil(t, err) reactions := topReactions.Items @@ -242,7 +242,7 @@ func TestGetTopReactionsForTeamSince(t *testing.T) { assert.Equal(t, expectedTopReactions[i].EmojiName, reaction.EmojiName) assert.Equal(t, expectedTopReactions[i].Count, reaction.Count) } - topReactions, err = th.App.GetTopReactionsForTeamSince(teamId, userId, &model.InsightsOpts{StartUnixMilli: timeRange, Page: 1, PerPage: 5}) + topReactions, err = th.App.GetTopReactionsForTeamSince(teamId, userId, &model.InsightsOpts{StartUnixMilli: timeRange.UnixMilli(), Page: 1, PerPage: 5}) require.Nil(t, err) reactions = topReactions.Items @@ -252,7 +252,7 @@ func TestGetTopReactionsForTeamSince(t *testing.T) { t.Run("get-top-reactions-for-team-since feature flag", func(t *testing.T) { th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = false }) - _, err := th.App.GetTopReactionsForTeamSince(userId, teamId, &model.InsightsOpts{StartUnixMilli: timeRange, Page: 0, PerPage: 5}) + _, err := th.App.GetTopReactionsForTeamSince(userId, teamId, &model.InsightsOpts{StartUnixMilli: timeRange.UnixMilli(), Page: 0, PerPage: 5}) assert.NotNil(t, err) }) } @@ -402,10 +402,10 @@ func TestGetTopReactionsForUserSince(t *testing.T) { expectedTopReactions[3] = &model.TopReaction{EmojiName: "heart", Count: int64(3)} expectedTopReactions[4] = &model.TopReaction{EmojiName: "blush", Count: int64(2)} - timeRange, _ := model.GetStartUnixMilliForTimeRange(model.TimeRangeToday) + timeRange := model.StartOfDayForTimeRange(model.TimeRangeToday, time.Now().Location()) t.Run("get-top-reactions-for-user-since", func(t *testing.T) { - topReactions, err := th.App.GetTopReactionsForUserSince(userId, teamId, &model.InsightsOpts{StartUnixMilli: timeRange, Page: 0, PerPage: 5}) + topReactions, err := th.App.GetTopReactionsForUserSince(userId, teamId, &model.InsightsOpts{StartUnixMilli: timeRange.UnixMilli(), Page: 0, PerPage: 5}) require.Nil(t, err) reactions := topReactions.Items @@ -414,7 +414,7 @@ func TestGetTopReactionsForUserSince(t *testing.T) { assert.Equal(t, expectedTopReactions[i].Count, reaction.Count) } - topReactions, err = th.App.GetTopReactionsForUserSince(userId, teamId, &model.InsightsOpts{StartUnixMilli: timeRange, Page: 1, PerPage: 5}) + topReactions, err = th.App.GetTopReactionsForUserSince(userId, teamId, &model.InsightsOpts{StartUnixMilli: timeRange.UnixMilli(), Page: 1, PerPage: 5}) require.Nil(t, err) reactions = topReactions.Items assert.Equal(t, "100", reactions[0].EmojiName) @@ -423,7 +423,7 @@ func TestGetTopReactionsForUserSince(t *testing.T) { t.Run("get-top-reactions-for-user-since feature flag", func(t *testing.T) { th.App.UpdateConfig(func(cfg *model.Config) { cfg.FeatureFlags.InsightsEnabled = false }) - _, err := th.App.GetTopReactionsForUserSince(userId, teamId, &model.InsightsOpts{StartUnixMilli: timeRange, Page: 0, PerPage: 5}) + _, err := th.App.GetTopReactionsForUserSince(userId, teamId, &model.InsightsOpts{StartUnixMilli: timeRange.UnixMilli(), Page: 0, PerPage: 5}) assert.NotNil(t, err) }) } diff --git a/i18n/en.json b/i18n/en.json index 30b842f1f5..75c21c1011 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -187,6 +187,10 @@ "id": "api.admin.upload_brand_image.too_large.app_error", "translation": "Unable to upload file. File is too large." }, + { + "id": "api.authorization_error.guest", + "translation": " " + }, { "id": "api.back_to_app", "translation": "Back to {{.SiteName}}" @@ -2053,6 +2057,10 @@ "id": "api.license_error", "translation": "api endpoint requires a license" }, + { + "id": "api.license_error.professional_or_enterprise", + "translation": " " + }, { "id": "api.marshal_error", "translation": "Failed to marshal." @@ -4531,6 +4539,10 @@ "id": "app.channel.get_pinnedpost_count.app_error", "translation": "Unable to get the channel pinned post count." }, + { + "id": "app.channel.get_post_count_by_day.app_error", + "translation": " " + }, { "id": "app.channel.get_private_channels.get.app_error", "translation": "Unable to get private channels." @@ -8531,10 +8543,6 @@ "id": "model.incoming_hook.username.app_error", "translation": "Invalid username." }, - { - "id": "model.insights.time_range.app_error", - "translation": " " - }, { "id": "model.job.is_valid.create_at.app_error", "translation": "Create at must be a valid time." diff --git a/model/insights.go b/model/insights.go index d28aec0f79..54db801170 100644 --- a/model/insights.go +++ b/model/insights.go @@ -4,14 +4,18 @@ package model import ( - "net/http" "time" ) +type PostCountGrouping string + const ( TimeRangeToday string = "today" TimeRange7Day string = "7_day" TimeRange28Day string = "28_day" + + PostsByHour PostCountGrouping = "hour" + PostsByDay PostCountGrouping = "day" ) type InsightsOpts struct { @@ -38,7 +42,16 @@ type TopReaction struct { // Top Channels type TopChannelList struct { InsightsListData - Items []*TopChannel `json:"items"` + Items []*TopChannel `json:"items"` + PostCountByDuration ChannelPostCountByDuration `json:"channel_post_counts_by_duration"` +} + +func (t *TopChannelList) ChannelIDs() []string { + var ids []string + for _, item := range t.Items { + ids = append(ids, item.ID) + } + return ids } type TopChannel struct { @@ -50,21 +63,116 @@ type TopChannel struct { MessageCount int64 `json:"message_count"` } -// GetStartUnixMilliForTimeRange gets the unix start time in milliseconds from the given time range. -// Time range can be one of: "1_day", "7_day", or "28_day". -func GetStartUnixMilliForTimeRange(timeRange string) (int64, *AppError) { - now := time.Now() - _, offset := now.Zone() +type DurationPostCount struct { + ChannelID string `db:"channelid"` + // Duration is an ISO8601 date string representing either a day or a day and hour (ex. "2022-05-26" or "2022-05-26T14"). + Duration string `db:"duration"` + PostCount int `db:"postcount"` +} + +func TimeRangeToNumberDays(timeRange string) int { + var n int switch timeRange { case TimeRangeToday: - return GetStartOfDayMillis(now, offset), nil + n = 1 case TimeRange7Day: - return GetStartOfDayMillis(now.Add(time.Hour*time.Duration(-168)), offset), nil + n = 7 case TimeRange28Day: - return GetStartOfDayMillis(now.Add(time.Hour*time.Duration(-672)), offset), nil + n = 28 + } + return n +} + +// ChannelPostCountByDuration contains a count of posts by channel id, grouped by ISO8601 date string. +// Example 1 (grouped by day): +// cpc := model.ChannelPostCountByDuration{ +// "2009-11-11": { +// "ezbp7nqxzjgdir8riodyafr9ww": 90, +// "p949c1xdojfgzffxma3p3s3ikr": 201, +// }, +// "2009-11-12": { +// "ezbp7nqxzjgdir8riodyafr9ww": 45, +// "p949c1xdojfgzffxma3p3s3ikr": 68, +// }, +// } +// Example 2 (grouped by hour): +// cpc := model.ChannelPostCountByDuration{ +// "2009-11-11T01": { +// "ezbp7nqxzjgdir8riodyafr9ww": 90, +// "p949c1xdojfgzffxma3p3s3ikr": 201, +// }, +// "2009-11-11T02": { +// "ezbp7nqxzjgdir8riodyafr9ww": 45, +// "p949c1xdojfgzffxma3p3s3ikr": 68, +// }, +// } +type ChannelPostCountByDuration map[string]map[string]int + +func blankChannelCountsMap(channelIDs []string) map[string]int { + blankChannelCounts := map[string]int{} + for _, id := range channelIDs { + blankChannelCounts[id] = 0 + } + return blankChannelCounts +} + +func ToDailyPostCountViewModel(dpc []*DurationPostCount, startTime *time.Time, numDays int, channelIDs []string) ChannelPostCountByDuration { + viewModel := ChannelPostCountByDuration{} + + keyTime := *startTime + nowAtLocation := time.Now().In(startTime.Location()) + + if numDays == 1 { + for keyTime.Before(nowAtLocation) { + dateTimeKey := keyTime.Format(time.RFC3339) + viewModel[dateTimeKey] = blankChannelCountsMap(channelIDs) + keyTime = keyTime.Add(time.Hour) + } + } else { + for keyTime.Before(nowAtLocation) { + dateTimeKey := keyTime.Format("2006-01-02") + viewModel[dateTimeKey] = blankChannelCountsMap(channelIDs) + keyTime = keyTime.Add(24 * time.Hour) + } } - return GetStartOfDayMillis(now, offset), NewAppError("Insights.IsValidRequest", "model.insights.time_range.app_error", nil, "", http.StatusBadRequest) + for _, item := range dpc { + var parseFormat string + var keyFormat string + if numDays == 1 { + parseFormat = "2006-01-02T15 " + keyFormat = time.RFC3339 + } else { + parseFormat = "2006-01-02" + keyFormat = parseFormat + } + durTime, err := time.ParseInLocation(parseFormat, item.Duration, startTime.Location()) + if err != nil { + continue + } + localizedKey := durTime.Format(keyFormat) + _, hasKey := viewModel[localizedKey] + if !hasKey { + viewModel[localizedKey] = map[string]int{} + } + viewModel[localizedKey][item.ChannelID] = item.PostCount + } + + return viewModel +} + +// StartOfDayForTimeRange gets the unix start time in milliseconds from the given time range. +// Time range can be one of: "today", "7_day", or "28_day". +func StartOfDayForTimeRange(timeRange string, location *time.Location) *time.Time { + now := time.Now().In(location) + resultTime := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, location) + switch timeRange { + case TimeRange7Day: + resultTime = resultTime.Add(time.Hour * time.Duration(-144)) + case TimeRange28Day: + resultTime = resultTime.Add(time.Hour * time.Duration(-648)) + } + return &resultTime } // GetTopReactionListWithPagination adds a rank to each item in the given list of TopReaction and checks if there is diff --git a/model/insights_test.go b/model/insights_test.go index ca1b371a12..55a9359d09 100644 --- a/model/insights_test.go +++ b/model/insights_test.go @@ -9,26 +9,6 @@ import ( "github.com/stretchr/testify/assert" ) -func TestGetStartUnixMilliForTimeRang(t *testing.T) { - tc := [3]string{"today", "7_day", "28_day"} - - for _, timeRange := range tc { - t.Run(timeRange, func(t *testing.T) { - _, err := GetStartUnixMilliForTimeRange(timeRange) - assert.Nil(t, err) - }) - } - - invalidTimeRanges := [3]string{"", "1_day", "10_day"} - - for _, timeRange := range invalidTimeRanges { - t.Run(timeRange, func(t *testing.T) { - _, err := GetStartUnixMilliForTimeRange(timeRange) - assert.NotNil(t, err) - }) - } -} - func TestGetTopReactionListWithPagination(t *testing.T) { reactions := []*TopReaction{ {EmojiName: "smile", Count: 200}, diff --git a/model/user.go b/model/user.go index 698f33772c..3edca4fa59 100644 --- a/model/user.go +++ b/model/user.go @@ -11,6 +11,7 @@ import ( "regexp" "sort" "strings" + "time" "unicode/utf8" "golang.org/x/crypto/bcrypt" @@ -782,6 +783,14 @@ func (u *User) GetPreferredTimezone() string { return GetPreferredTimezone(u.Timezone) } +func (u *User) GetTimezoneLocation() *time.Location { + loc, _ := time.LoadLocation(u.GetPreferredTimezone()) + if loc == nil { + loc = time.Now().UTC().Location() + } + return loc +} + // IsRemote returns true if the user belongs to a remote cluster (has RemoteId). func (u *User) IsRemote() bool { return u.RemoteId != nil && *u.RemoteId != "" diff --git a/store/layer_generators/opentracing_layer.go.tmpl b/store/layer_generators/opentracing_layer.go.tmpl index b6ac76bc17..c309997008 100644 --- a/store/layer_generators/opentracing_layer.go.tmpl +++ b/store/layer_generators/opentracing_layer.go.tmpl @@ -8,6 +8,7 @@ package opentracinglayer import ( "context" + "time" "github.com/mattermost/mattermost-server/v6/model" "github.com/mattermost/mattermost-server/v6/services/tracing" diff --git a/store/layer_generators/retry_layer.go.tmpl b/store/layer_generators/retry_layer.go.tmpl index affa9e893a..17a5e01b5f 100644 --- a/store/layer_generators/retry_layer.go.tmpl +++ b/store/layer_generators/retry_layer.go.tmpl @@ -9,6 +9,7 @@ package retrylayer import ( "context" timepkg "time" + "time" "github.com/lib/pq" "github.com/mattermost/mattermost-server/v6/model" diff --git a/store/layer_generators/timer_layer.go.tmpl b/store/layer_generators/timer_layer.go.tmpl index 30879275e8..54d37bd1ff 100644 --- a/store/layer_generators/timer_layer.go.tmpl +++ b/store/layer_generators/timer_layer.go.tmpl @@ -8,7 +8,7 @@ package timerlayer import ( "context" - timemodule "time" + "time" "github.com/mattermost/mattermost-server/v6/einterfaces" "github.com/mattermost/mattermost-server/v6/model" @@ -38,13 +38,13 @@ type {{.Name}} struct { {{range $substoreName, $substore := .SubStores}} {{range $index, $element := $substore.Methods}} func (s *{{$.Name}}{{$substoreName}}Store) {{$index}}({{$element.Params | joinParamsWithType}}) {{$element.Results | joinResultsForSignature}} { - start := timemodule.Now() + start := time.Now() {{if $element.Results | len | eq 0}} s.{{$substoreName}}Store.{{$index}}({{$element.Params | joinParams}}) {{else}} {{genResultsVars $element.Results false }} := s.{{$substoreName}}Store.{{$index}}({{$element.Params | joinParams}}) {{end}} - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if {{$element.Results | errorToBoolean}} { diff --git a/store/opentracinglayer/opentracinglayer.go b/store/opentracinglayer/opentracinglayer.go index 65dd8757e1..f2ce731216 100644 --- a/store/opentracinglayer/opentracinglayer.go +++ b/store/opentracinglayer/opentracinglayer.go @@ -8,6 +8,7 @@ package opentracinglayer import ( "context" + "time" "github.com/mattermost/mattermost-server/v6/model" "github.com/mattermost/mattermost-server/v6/services/tracing" @@ -745,7 +746,7 @@ func (s *OpenTracingLayerChannelStore) CreateSidebarCategory(userID string, team return result, err } -func (s *OpenTracingLayerChannelStore) Delete(channelID string, time int64) error { +func (s *OpenTracingLayerChannelStore) Delete(channelID string, timestamp int64) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.Delete") s.Root.Store.SetContext(newCtx) @@ -754,7 +755,7 @@ func (s *OpenTracingLayerChannelStore) Delete(channelID string, time int64) erro }() defer span.Finish() - err := s.ChannelStore.Delete(channelID, time) + err := s.ChannelStore.Delete(channelID, timestamp) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -2014,6 +2015,24 @@ func (s *OpenTracingLayerChannelStore) PermanentDeleteMembersByUser(userID strin return err } +func (s *OpenTracingLayerChannelStore) PostCountsByDuration(channelIDs []string, sinceUnixMillis int64, userID *string, duration model.PostCountGrouping, groupingLocation *time.Location) ([]*model.DurationPostCount, error) { + origCtx := s.Root.Store.Context() + span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.PostCountsByDuration") + s.Root.Store.SetContext(newCtx) + defer func() { + s.Root.Store.SetContext(origCtx) + }() + + defer span.Finish() + result, err := s.ChannelStore.PostCountsByDuration(channelIDs, sinceUnixMillis, userID, duration, groupingLocation) + if err != nil { + span.LogFields(spanlog.Error(err)) + ext.Error.Set(span, true) + } + + return result, err +} + func (s *OpenTracingLayerChannelStore) RemoveAllDeactivatedMembers(channelID string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.RemoveAllDeactivatedMembers") @@ -2086,7 +2105,7 @@ func (s *OpenTracingLayerChannelStore) ResetAllChannelSchemes() error { return err } -func (s *OpenTracingLayerChannelStore) Restore(channelID string, time int64) error { +func (s *OpenTracingLayerChannelStore) Restore(channelID string, timestamp int64) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "ChannelStore.Restore") s.Root.Store.SetContext(newCtx) @@ -2095,7 +2114,7 @@ func (s *OpenTracingLayerChannelStore) Restore(channelID string, time int64) err }() defer span.Finish() - err := s.ChannelStore.Restore(channelID, time) + err := s.ChannelStore.Restore(channelID, timestamp) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -2788,7 +2807,7 @@ func (s *OpenTracingLayerCommandStore) AnalyticsCommandCount(teamID string) (int return result, err } -func (s *OpenTracingLayerCommandStore) Delete(commandID string, time int64) error { +func (s *OpenTracingLayerCommandStore) Delete(commandID string, timestamp int64) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "CommandStore.Delete") s.Root.Store.SetContext(newCtx) @@ -2797,7 +2816,7 @@ func (s *OpenTracingLayerCommandStore) Delete(commandID string, time int64) erro }() defer span.Finish() - err := s.CommandStore.Delete(commandID, time) + err := s.CommandStore.Delete(commandID, timestamp) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -3107,7 +3126,7 @@ func (s *OpenTracingLayerComplianceStore) Update(compliance *model.Compliance) ( return result, err } -func (s *OpenTracingLayerEmojiStore) Delete(emoji *model.Emoji, time int64) error { +func (s *OpenTracingLayerEmojiStore) Delete(emoji *model.Emoji, timestamp int64) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "EmojiStore.Delete") s.Root.Store.SetContext(newCtx) @@ -3116,7 +3135,7 @@ func (s *OpenTracingLayerEmojiStore) Delete(emoji *model.Emoji, time int64) erro }() defer span.Finish() - err := s.EmojiStore.Delete(emoji, time) + err := s.EmojiStore.Delete(emoji, timestamp) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -5450,7 +5469,7 @@ func (s *OpenTracingLayerPostStore) ClearCaches() { } -func (s *OpenTracingLayerPostStore) Delete(postID string, time int64, deleteByID string) error { +func (s *OpenTracingLayerPostStore) Delete(postID string, timestamp int64, deleteByID string) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.Delete") s.Root.Store.SetContext(newCtx) @@ -5459,7 +5478,7 @@ func (s *OpenTracingLayerPostStore) Delete(postID string, time int64, deleteByID }() defer span.Finish() - err := s.PostStore.Delete(postID, time, deleteByID) + err := s.PostStore.Delete(postID, timestamp, deleteByID) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -5682,7 +5701,7 @@ func (s *OpenTracingLayerPostStore) GetParentsForExportAfter(limit int, afterID return result, err } -func (s *OpenTracingLayerPostStore) GetPostAfterTime(channelID string, time int64, collapsedThreads bool) (*model.Post, error) { +func (s *OpenTracingLayerPostStore) GetPostAfterTime(channelID string, timestamp int64, collapsedThreads bool) (*model.Post, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetPostAfterTime") s.Root.Store.SetContext(newCtx) @@ -5691,7 +5710,7 @@ func (s *OpenTracingLayerPostStore) GetPostAfterTime(channelID string, time int6 }() defer span.Finish() - result, err := s.PostStore.GetPostAfterTime(channelID, time, collapsedThreads) + result, err := s.PostStore.GetPostAfterTime(channelID, timestamp, collapsedThreads) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -5700,7 +5719,7 @@ func (s *OpenTracingLayerPostStore) GetPostAfterTime(channelID string, time int6 return result, err } -func (s *OpenTracingLayerPostStore) GetPostIdAfterTime(channelID string, time int64, collapsedThreads bool) (string, error) { +func (s *OpenTracingLayerPostStore) GetPostIdAfterTime(channelID string, timestamp int64, collapsedThreads bool) (string, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetPostIdAfterTime") s.Root.Store.SetContext(newCtx) @@ -5709,7 +5728,7 @@ func (s *OpenTracingLayerPostStore) GetPostIdAfterTime(channelID string, time in }() defer span.Finish() - result, err := s.PostStore.GetPostIdAfterTime(channelID, time, collapsedThreads) + result, err := s.PostStore.GetPostIdAfterTime(channelID, timestamp, collapsedThreads) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -5718,7 +5737,7 @@ func (s *OpenTracingLayerPostStore) GetPostIdAfterTime(channelID string, time in return result, err } -func (s *OpenTracingLayerPostStore) GetPostIdBeforeTime(channelID string, time int64, collapsedThreads bool) (string, error) { +func (s *OpenTracingLayerPostStore) GetPostIdBeforeTime(channelID string, timestamp int64, collapsedThreads bool) (string, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetPostIdBeforeTime") s.Root.Store.SetContext(newCtx) @@ -5727,7 +5746,7 @@ func (s *OpenTracingLayerPostStore) GetPostIdBeforeTime(channelID string, time i }() defer span.Finish() - result, err := s.PostStore.GetPostIdBeforeTime(channelID, time, collapsedThreads) + result, err := s.PostStore.GetPostIdBeforeTime(channelID, timestamp, collapsedThreads) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -5826,7 +5845,7 @@ func (s *OpenTracingLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Po return result, err } -func (s *OpenTracingLayerPostStore) GetPostsCreatedAt(channelID string, time int64) ([]*model.Post, error) { +func (s *OpenTracingLayerPostStore) GetPostsCreatedAt(channelID string, timestamp int64) ([]*model.Post, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "PostStore.GetPostsCreatedAt") s.Root.Store.SetContext(newCtx) @@ -5835,7 +5854,7 @@ func (s *OpenTracingLayerPostStore) GetPostsCreatedAt(channelID string, time int }() defer span.Finish() - result, err := s.PostStore.GetPostsCreatedAt(channelID, time) + result, err := s.PostStore.GetPostsCreatedAt(channelID, timestamp) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -7639,7 +7658,7 @@ func (s *OpenTracingLayerSessionStore) UpdateExpiredNotify(sessionid string, not return err } -func (s *OpenTracingLayerSessionStore) UpdateExpiresAt(sessionID string, time int64) error { +func (s *OpenTracingLayerSessionStore) UpdateExpiresAt(sessionID string, timestamp int64) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateExpiresAt") s.Root.Store.SetContext(newCtx) @@ -7648,7 +7667,7 @@ func (s *OpenTracingLayerSessionStore) UpdateExpiresAt(sessionID string, time in }() defer span.Finish() - err := s.SessionStore.UpdateExpiresAt(sessionID, time) + err := s.SessionStore.UpdateExpiresAt(sessionID, timestamp) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -7657,7 +7676,7 @@ func (s *OpenTracingLayerSessionStore) UpdateExpiresAt(sessionID string, time in return err } -func (s *OpenTracingLayerSessionStore) UpdateLastActivityAt(sessionID string, time int64) error { +func (s *OpenTracingLayerSessionStore) UpdateLastActivityAt(sessionID string, timestamp int64) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "SessionStore.UpdateLastActivityAt") s.Root.Store.SetContext(newCtx) @@ -7666,7 +7685,7 @@ func (s *OpenTracingLayerSessionStore) UpdateLastActivityAt(sessionID string, ti }() defer span.Finish() - err := s.SessionStore.UpdateLastActivityAt(sessionID, time) + err := s.SessionStore.UpdateLastActivityAt(sessionID, timestamp) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -10000,7 +10019,7 @@ func (s *OpenTracingLayerUploadSessionStore) Update(session *model.UploadSession return err } -func (s *OpenTracingLayerUserStore) AnalyticsActiveCount(time int64, options model.UserCountOptions) (int64, error) { +func (s *OpenTracingLayerUserStore) AnalyticsActiveCount(timestamp int64, options model.UserCountOptions) (int64, error) { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "UserStore.AnalyticsActiveCount") s.Root.Store.SetContext(newCtx) @@ -10009,7 +10028,7 @@ func (s *OpenTracingLayerUserStore) AnalyticsActiveCount(time int64, options mod }() defer span.Finish() - result, err := s.UserStore.AnalyticsActiveCount(time, options) + result, err := s.UserStore.AnalyticsActiveCount(timestamp, options) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -11598,7 +11617,7 @@ func (s *OpenTracingLayerWebhookStore) ClearCaches() { } -func (s *OpenTracingLayerWebhookStore) DeleteIncoming(webhookID string, time int64) error { +func (s *OpenTracingLayerWebhookStore) DeleteIncoming(webhookID string, timestamp int64) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "WebhookStore.DeleteIncoming") s.Root.Store.SetContext(newCtx) @@ -11607,7 +11626,7 @@ func (s *OpenTracingLayerWebhookStore) DeleteIncoming(webhookID string, time int }() defer span.Finish() - err := s.WebhookStore.DeleteIncoming(webhookID, time) + err := s.WebhookStore.DeleteIncoming(webhookID, timestamp) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) @@ -11616,7 +11635,7 @@ func (s *OpenTracingLayerWebhookStore) DeleteIncoming(webhookID string, time int return err } -func (s *OpenTracingLayerWebhookStore) DeleteOutgoing(webhookID string, time int64) error { +func (s *OpenTracingLayerWebhookStore) DeleteOutgoing(webhookID string, timestamp int64) error { origCtx := s.Root.Store.Context() span, newCtx := tracing.StartSpanWithParentByContext(s.Root.Store.Context(), "WebhookStore.DeleteOutgoing") s.Root.Store.SetContext(newCtx) @@ -11625,7 +11644,7 @@ func (s *OpenTracingLayerWebhookStore) DeleteOutgoing(webhookID string, time int }() defer span.Finish() - err := s.WebhookStore.DeleteOutgoing(webhookID, time) + err := s.WebhookStore.DeleteOutgoing(webhookID, timestamp) if err != nil { span.LogFields(spanlog.Error(err)) ext.Error.Set(span, true) diff --git a/store/retrylayer/retrylayer.go b/store/retrylayer/retrylayer.go index 1965dac03e..cac57e48bd 100644 --- a/store/retrylayer/retrylayer.go +++ b/store/retrylayer/retrylayer.go @@ -8,6 +8,7 @@ package retrylayer import ( "context" + "time" timepkg "time" "github.com/go-sql-driver/mysql" @@ -814,11 +815,11 @@ func (s *RetryLayerChannelStore) CreateSidebarCategory(userID string, teamID str } -func (s *RetryLayerChannelStore) Delete(channelID string, time int64) error { +func (s *RetryLayerChannelStore) Delete(channelID string, timestamp int64) error { tries := 0 for { - err := s.ChannelStore.Delete(channelID, time) + err := s.ChannelStore.Delete(channelID, timestamp) if err == nil { return nil } @@ -2212,6 +2213,27 @@ func (s *RetryLayerChannelStore) PermanentDeleteMembersByUser(userID string) err } +func (s *RetryLayerChannelStore) PostCountsByDuration(channelIDs []string, sinceUnixMillis int64, userID *string, duration model.PostCountGrouping, groupingLocation *time.Location) ([]*model.DurationPostCount, error) { + + tries := 0 + for { + result, err := s.ChannelStore.PostCountsByDuration(channelIDs, sinceUnixMillis, userID, duration, groupingLocation) + if err == nil { + return result, nil + } + if !isRepeatableError(err) { + return result, err + } + tries++ + if tries >= 3 { + err = errors.Wrap(err, "giving up after 3 consecutive repeatable transaction failures") + return result, err + } + timepkg.Sleep(100 * timepkg.Millisecond) + } + +} + func (s *RetryLayerChannelStore) RemoveAllDeactivatedMembers(channelID string) error { tries := 0 @@ -2296,11 +2318,11 @@ func (s *RetryLayerChannelStore) ResetAllChannelSchemes() error { } -func (s *RetryLayerChannelStore) Restore(channelID string, time int64) error { +func (s *RetryLayerChannelStore) Restore(channelID string, timestamp int64) error { tries := 0 for { - err := s.ChannelStore.Restore(channelID, time) + err := s.ChannelStore.Restore(channelID, timestamp) if err == nil { return nil } @@ -3115,11 +3137,11 @@ func (s *RetryLayerCommandStore) AnalyticsCommandCount(teamID string) (int64, er } -func (s *RetryLayerCommandStore) Delete(commandID string, time int64) error { +func (s *RetryLayerCommandStore) Delete(commandID string, timestamp int64) error { tries := 0 for { - err := s.CommandStore.Delete(commandID, time) + err := s.CommandStore.Delete(commandID, timestamp) if err == nil { return nil } @@ -3478,11 +3500,11 @@ func (s *RetryLayerComplianceStore) Update(compliance *model.Compliance) (*model } -func (s *RetryLayerEmojiStore) Delete(emoji *model.Emoji, time int64) error { +func (s *RetryLayerEmojiStore) Delete(emoji *model.Emoji, timestamp int64) error { tries := 0 for { - err := s.EmojiStore.Delete(emoji, time) + err := s.EmojiStore.Delete(emoji, timestamp) if err == nil { return nil } @@ -6184,11 +6206,11 @@ func (s *RetryLayerPostStore) ClearCaches() { } -func (s *RetryLayerPostStore) Delete(postID string, time int64, deleteByID string) error { +func (s *RetryLayerPostStore) Delete(postID string, timestamp int64, deleteByID string) error { tries := 0 for { - err := s.PostStore.Delete(postID, time, deleteByID) + err := s.PostStore.Delete(postID, timestamp, deleteByID) if err == nil { return nil } @@ -6427,11 +6449,11 @@ func (s *RetryLayerPostStore) GetParentsForExportAfter(limit int, afterID string } -func (s *RetryLayerPostStore) GetPostAfterTime(channelID string, time int64, collapsedThreads bool) (*model.Post, error) { +func (s *RetryLayerPostStore) GetPostAfterTime(channelID string, timestamp int64, collapsedThreads bool) (*model.Post, error) { tries := 0 for { - result, err := s.PostStore.GetPostAfterTime(channelID, time, collapsedThreads) + result, err := s.PostStore.GetPostAfterTime(channelID, timestamp, collapsedThreads) if err == nil { return result, nil } @@ -6448,11 +6470,11 @@ func (s *RetryLayerPostStore) GetPostAfterTime(channelID string, time int64, col } -func (s *RetryLayerPostStore) GetPostIdAfterTime(channelID string, time int64, collapsedThreads bool) (string, error) { +func (s *RetryLayerPostStore) GetPostIdAfterTime(channelID string, timestamp int64, collapsedThreads bool) (string, error) { tries := 0 for { - result, err := s.PostStore.GetPostIdAfterTime(channelID, time, collapsedThreads) + result, err := s.PostStore.GetPostIdAfterTime(channelID, timestamp, collapsedThreads) if err == nil { return result, nil } @@ -6469,11 +6491,11 @@ func (s *RetryLayerPostStore) GetPostIdAfterTime(channelID string, time int64, c } -func (s *RetryLayerPostStore) GetPostIdBeforeTime(channelID string, time int64, collapsedThreads bool) (string, error) { +func (s *RetryLayerPostStore) GetPostIdBeforeTime(channelID string, timestamp int64, collapsedThreads bool) (string, error) { tries := 0 for { - result, err := s.PostStore.GetPostIdBeforeTime(channelID, time, collapsedThreads) + result, err := s.PostStore.GetPostIdBeforeTime(channelID, timestamp, collapsedThreads) if err == nil { return result, nil } @@ -6595,11 +6617,11 @@ func (s *RetryLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, er } -func (s *RetryLayerPostStore) GetPostsCreatedAt(channelID string, time int64) ([]*model.Post, error) { +func (s *RetryLayerPostStore) GetPostsCreatedAt(channelID string, timestamp int64) ([]*model.Post, error) { tries := 0 for { - result, err := s.PostStore.GetPostsCreatedAt(channelID, time) + result, err := s.PostStore.GetPostsCreatedAt(channelID, timestamp) if err == nil { return result, nil } @@ -8701,11 +8723,11 @@ func (s *RetryLayerSessionStore) UpdateExpiredNotify(sessionid string, notified } -func (s *RetryLayerSessionStore) UpdateExpiresAt(sessionID string, time int64) error { +func (s *RetryLayerSessionStore) UpdateExpiresAt(sessionID string, timestamp int64) error { tries := 0 for { - err := s.SessionStore.UpdateExpiresAt(sessionID, time) + err := s.SessionStore.UpdateExpiresAt(sessionID, timestamp) if err == nil { return nil } @@ -8722,11 +8744,11 @@ func (s *RetryLayerSessionStore) UpdateExpiresAt(sessionID string, time int64) e } -func (s *RetryLayerSessionStore) UpdateLastActivityAt(sessionID string, time int64) error { +func (s *RetryLayerSessionStore) UpdateLastActivityAt(sessionID string, timestamp int64) error { tries := 0 for { - err := s.SessionStore.UpdateLastActivityAt(sessionID, time) + err := s.SessionStore.UpdateLastActivityAt(sessionID, timestamp) if err == nil { return nil } @@ -11428,11 +11450,11 @@ func (s *RetryLayerUploadSessionStore) Update(session *model.UploadSession) erro } -func (s *RetryLayerUserStore) AnalyticsActiveCount(time int64, options model.UserCountOptions) (int64, error) { +func (s *RetryLayerUserStore) AnalyticsActiveCount(timestamp int64, options model.UserCountOptions) (int64, error) { tries := 0 for { - result, err := s.UserStore.AnalyticsActiveCount(time, options) + result, err := s.UserStore.AnalyticsActiveCount(timestamp, options) if err == nil { return result, nil } @@ -13219,11 +13241,11 @@ func (s *RetryLayerWebhookStore) ClearCaches() { } -func (s *RetryLayerWebhookStore) DeleteIncoming(webhookID string, time int64) error { +func (s *RetryLayerWebhookStore) DeleteIncoming(webhookID string, timestamp int64) error { tries := 0 for { - err := s.WebhookStore.DeleteIncoming(webhookID, time) + err := s.WebhookStore.DeleteIncoming(webhookID, timestamp) if err == nil { return nil } @@ -13240,11 +13262,11 @@ func (s *RetryLayerWebhookStore) DeleteIncoming(webhookID string, time int64) er } -func (s *RetryLayerWebhookStore) DeleteOutgoing(webhookID string, time int64) error { +func (s *RetryLayerWebhookStore) DeleteOutgoing(webhookID string, timestamp int64) error { tries := 0 for { - err := s.WebhookStore.DeleteOutgoing(webhookID, time) + err := s.WebhookStore.DeleteOutgoing(webhookID, timestamp) if err == nil { return nil } diff --git a/store/sqlstore/channel_store.go b/store/sqlstore/channel_store.go index 072f765c49..fde764f40b 100644 --- a/store/sqlstore/channel_store.go +++ b/store/sqlstore/channel_store.go @@ -4297,3 +4297,53 @@ func (s SqlChannelStore) GetTopChannelsForUserSince(userID string, teamID string return model.GetTopChannelListWithPagination(channels, limit), nil } + +func (s SqlChannelStore) PostCountsByDuration(channelIDs []string, sinceUnixMillis int64, userID *string, duration model.PostCountGrouping, atLocation *time.Location) ([]*model.DurationPostCount, error) { + var unixSelect string + var propsQuery string + loc := atLocation.String() + if loc == "Local" { + loc = "UTC" + } + if s.DriverName() == model.DatabaseDriverMysql { + if duration == model.PostsByDay { + unixSelect = `DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(Posts.CreateAt / 1000), 'GMT', '` + loc + `'),'%Y-%m-%d') AS duration` + } else { + unixSelect = `DATE_FORMAT(CONVERT_TZ(FROM_UNIXTIME(Posts.CreateAt / 1000), 'GMT', '` + loc + `'),'%Y-%m-%dT%H') AS duration` + } + propsQuery = `(JSON_EXTRACT(Posts.Props, '$.from_bot') IS NULL OR JSON_EXTRACT(Posts.Props, '$.from_bot') = 'false')` + } else if s.DriverName() == model.DatabaseDriverPostgres { + if duration == model.PostsByDay { + unixSelect = fmt.Sprintf(`TO_CHAR(TO_TIMESTAMP(Posts.CreateAt / 1000) AT TIME ZONE '%s', 'YYYY-MM-DD') AS duration`, loc) + } else { + unixSelect = fmt.Sprintf(`TO_CHAR(TO_TIMESTAMP(Posts.CreateAt / 1000) AT TIME ZONE '%s', 'YYYY-MM-DD"T"HH24') AS duration`, loc) + } + propsQuery = `(Posts.Props ->> 'from_bot' IS NULL OR Posts.Props ->> 'from_bot' = 'false')` + } + query := sq. + Select("Posts.ChannelId AS channelid", unixSelect, "count(Posts.Id) AS postcount"). + From("Posts"). + LeftJoin("Channels ON Posts.ChannelId = Channels.Id"). + Where(sq.And{ + sq.Eq{"Posts.DeleteAt": 0}, + sq.Gt{"Posts.CreateAt": sinceUnixMillis}, + sq.Eq{"Posts.Type": ""}, + sq.Eq{"Channels.Id": channelIDs}, + }). + Where(propsQuery). + GroupBy("channelid", "duration"). + OrderBy("channelid", "duration") + if userID != nil && model.IsValidId(*userID) { + query = query.Where(sq.And{sq.Eq{"Posts.UserId": *userID}}) + } + queryString, args, err := query.ToSql() + if err != nil { + return nil, errors.Wrap(err, "failed to parse query") + } + dailyPostCounts := make([]*model.DurationPostCount, 0) + if err := s.GetReplicaX().Select(&dailyPostCounts, queryString, args...); err != nil { + return nil, errors.Wrap(err, "failed to get post counts by duration") + } + + return dailyPostCounts, nil +} diff --git a/store/store.go b/store/store.go index 1539c2ac39..684fdd3d9b 100644 --- a/store/store.go +++ b/store/store.go @@ -178,8 +178,8 @@ type ChannelStore interface { GetMany(ids []string, allowFromCache bool) (model.ChannelList, error) InvalidateChannel(id string) InvalidateChannelByName(teamID, name string) - Delete(channelID string, time int64) error - Restore(channelID string, time int64) error + Delete(channelID string, timestamp int64) error + Restore(channelID string, timestamp int64) error SetDeleteAt(channelID string, deleteAt int64, updateAt int64) error PermanentDelete(channelID string) error PermanentDeleteByTeam(teamID string) error @@ -293,6 +293,7 @@ type ChannelStore interface { // Insights GetTopChannelsForTeamSince(teamID string, userID string, since int64, offset int, limit int) (*model.TopChannelList, error) GetTopChannelsForUserSince(userID string, teamID string, since int64, offset int, limit int) (*model.TopChannelList, error) + PostCountsByDuration(channelIDs []string, sinceUnixMillis int64, userID *string, duration model.PostCountGrouping, groupingLocation *time.Location) ([]*model.DurationPostCount, error) } type ChannelMemberHistoryStore interface { @@ -338,7 +339,7 @@ type PostStore interface { Update(newPost *model.Post, oldPost *model.Post) (*model.Post, error) Get(ctx context.Context, id string, opts model.GetPostsOptions, userID string, sanitizeOptions map[string]bool) (*model.PostList, error) GetSingle(id string, inclDeleted bool) (*model.Post, error) - Delete(postID string, time int64, deleteByID string) error + Delete(postID string, timestamp int64, deleteByID string) error PermanentDeleteByUser(userID string) error PermanentDeleteByChannel(channelID string) error GetPosts(options model.GetPostsOptions, allowFromCache bool, sanitizeOptions map[string]bool) (*model.PostList, error) @@ -349,9 +350,9 @@ type PostStore interface { GetPostsBefore(options model.GetPostsOptions, sanitizeOptions map[string]bool) (*model.PostList, error) GetPostsAfter(options model.GetPostsOptions, sanitizeOptions map[string]bool) (*model.PostList, error) GetPostsSince(options model.GetPostsSinceOptions, allowFromCache bool, sanitizeOptions map[string]bool) (*model.PostList, error) - GetPostAfterTime(channelID string, time int64, collapsedThreads bool) (*model.Post, error) - GetPostIdAfterTime(channelID string, time int64, collapsedThreads bool) (string, error) - GetPostIdBeforeTime(channelID string, time int64, collapsedThreads bool) (string, error) + GetPostAfterTime(channelID string, timestamp int64, collapsedThreads bool) (*model.Post, error) + GetPostIdAfterTime(channelID string, timestamp int64, collapsedThreads bool) (string, error) + GetPostIdBeforeTime(channelID string, timestamp int64, collapsedThreads bool) (string, error) GetEtag(channelID string, allowFromCache bool, collapsedThreads bool) string Search(teamID string, userID string, params *model.SearchParams) (*model.PostList, error) AnalyticsUserCountsWithPostsByDay(teamID string) (model.AnalyticsRows, error) @@ -360,7 +361,7 @@ type PostStore interface { ClearCaches() InvalidateLastPostTimeCache(channelID string) GetLastPostRowCreateAt() (int64, error) - GetPostsCreatedAt(channelID string, time int64) ([]*model.Post, error) + GetPostsCreatedAt(channelID string, timestamp int64) ([]*model.Post, error) Overwrite(post *model.Post) (*model.Post, error) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error) GetPostsByIds(postIds []string) ([]*model.Post, error) @@ -422,7 +423,7 @@ type UserStore interface { UpdateFailedPasswordAttempts(userID string, attempts int) error GetSystemAdminProfiles() (map[string]*model.User, error) PermanentDelete(userID string) error - AnalyticsActiveCount(time int64, options model.UserCountOptions) (int64, error) + AnalyticsActiveCount(timestamp int64, options model.UserCountOptions) (int64, error) AnalyticsActiveCountForPeriod(startTime int64, endTime int64, options model.UserCountOptions) (int64, error) GetUnreadCount(userID string) (int64, error) GetUnreadCountForChannel(userID string, channelID string) (int64, error) @@ -478,8 +479,8 @@ type SessionStore interface { RemoveAllSessions() error PermanentDeleteSessionsByUser(teamID string) error GetLastSessionRowCreateAt() (int64, error) - UpdateExpiresAt(sessionID string, time int64) error - UpdateLastActivityAt(sessionID string, time int64) error + UpdateExpiresAt(sessionID string, timestamp int64) error + UpdateLastActivityAt(sessionID string, timestamp int64) error UpdateRoles(userID string, roles string) (string, error) UpdateDeviceId(id string, deviceID string, expiresAt int64) (string, error) UpdateProps(session *model.Session) error @@ -563,7 +564,7 @@ type WebhookStore interface { GetIncomingByTeamByUser(teamID string, userID string, offset, limit int) ([]*model.IncomingWebhook, error) UpdateIncoming(webhook *model.IncomingWebhook) (*model.IncomingWebhook, error) GetIncomingByChannel(channelID string) ([]*model.IncomingWebhook, error) - DeleteIncoming(webhookID string, time int64) error + DeleteIncoming(webhookID string, timestamp int64) error PermanentDeleteIncomingByChannel(channelID string) error PermanentDeleteIncomingByUser(userID string) error @@ -575,7 +576,7 @@ type WebhookStore interface { GetOutgoingListByUser(userID string, offset, limit int) ([]*model.OutgoingWebhook, error) GetOutgoingByTeam(teamID string, offset, limit int) ([]*model.OutgoingWebhook, error) GetOutgoingByTeamByUser(teamID string, userID string, offset, limit int) ([]*model.OutgoingWebhook, error) - DeleteOutgoing(webhookID string, time int64) error + DeleteOutgoing(webhookID string, timestamp int64) error PermanentDeleteOutgoingByChannel(channelID string) error PermanentDeleteOutgoingByUser(userID string) error UpdateOutgoing(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, error) @@ -591,7 +592,7 @@ type CommandStore interface { GetByTrigger(teamID string, trigger string) (*model.Command, error) Get(id string) (*model.Command, error) GetByTeam(teamID string) ([]*model.Command, error) - Delete(commandID string, time int64) error + Delete(commandID string, timestamp int64) error PermanentDeleteByTeam(teamID string) error PermanentDeleteByUser(userID string) error Update(hook *model.Command) (*model.Command, error) @@ -639,7 +640,7 @@ type EmojiStore interface { GetByName(ctx context.Context, name string, allowFromCache bool) (*model.Emoji, error) GetMultipleByName(names []string) ([]*model.Emoji, error) GetList(offset, limit int, sort string) ([]*model.Emoji, error) - Delete(emoji *model.Emoji, time int64) error + Delete(emoji *model.Emoji, timestamp int64) error Search(name string, prefixOnly bool, limit int) ([]*model.Emoji, error) } diff --git a/store/storetest/channel_store.go b/store/storetest/channel_store.go index fed8e3166a..5c87ff4e98 100644 --- a/store/storetest/channel_store.go +++ b/store/storetest/channel_store.go @@ -148,6 +148,7 @@ func TestChannelStore(t *testing.T, ss store.Store, s SqlStore) { t.Run("UpdateSidebarChannelsByPreferences", func(t *testing.T) { testUpdateSidebarChannelsByPreferences(t, ss) }) t.Run("SetShared", func(t *testing.T) { testSetShared(t, ss) }) t.Run("GetTeamForChannel", func(t *testing.T) { testGetTeamForChannel(t, ss) }) + t.Run("PostCountsByDuration", func(t *testing.T) { testChannelPostCountsByDuration(t, ss) }) } func testChannelStoreSave(t *testing.T, ss store.Store) { @@ -7904,3 +7905,38 @@ func testGetTeamForChannel(t *testing.T, ss store.Store) { var nfErr *store.ErrNotFound require.True(t, errors.As(err, &nfErr)) } + +func testChannelPostCountsByDuration(t *testing.T, ss store.Store) { + team, err := ss.Team().Save(&model.Team{ + Name: model.NewId(), + DisplayName: "DisplayName", + Email: MakeEmail(), + Type: model.TeamOpen, + }) + require.NoError(t, err) + defer func() { ss.Team().PermanentDelete(team.Id) }() + + channel := &model.Channel{ + TeamId: team.Id, + DisplayName: "test_share_flag", + Name: "test_share_flag", + Type: model.ChannelTypeOpen, + } + channelSaved, err := ss.Channel().Save(channel, 999) + require.NoError(t, err) + defer func() { ss.Channel().PermanentDelete(channelSaved.Id) }() + + userID := model.NewId() + _, err = ss.Post().Save(&model.Post{ + UserId: userID, + ChannelId: channel.Id, + Message: "test", + }) + require.NoError(t, err) + + dpc, err := ss.Channel().PostCountsByDuration([]string{channelSaved.Id}, 0, &userID, model.PostsByDay, time.Now().Location()) + require.NoError(t, err) + require.Len(t, dpc, 1) + require.Equal(t, channel.Id, dpc[0].ChannelID) + require.Equal(t, 1, dpc[0].PostCount) +} diff --git a/store/storetest/mocks/ChannelStore.go b/store/storetest/mocks/ChannelStore.go index f99995ffa4..070706699f 100644 --- a/store/storetest/mocks/ChannelStore.go +++ b/store/storetest/mocks/ChannelStore.go @@ -11,6 +11,8 @@ import ( mock "github.com/stretchr/testify/mock" store "github.com/mattermost/mattermost-server/v6/store" + + time "time" ) // ChannelStore is an autogenerated mock type for the ChannelStore type @@ -266,13 +268,13 @@ func (_m *ChannelStore) CreateSidebarCategory(userID string, teamID string, newC return r0, r1 } -// Delete provides a mock function with given fields: channelID, time -func (_m *ChannelStore) Delete(channelID string, time int64) error { - ret := _m.Called(channelID, time) +// Delete provides a mock function with given fields: channelID, timestamp +func (_m *ChannelStore) Delete(channelID string, timestamp int64) error { + ret := _m.Called(channelID, timestamp) var r0 error if rf, ok := ret.Get(0).(func(string, int64) error); ok { - r0 = rf(channelID, time) + r0 = rf(channelID, timestamp) } else { r0 = ret.Error(0) } @@ -1717,6 +1719,29 @@ func (_m *ChannelStore) PermanentDeleteMembersByUser(userID string) error { return r0 } +// PostCountsByDuration provides a mock function with given fields: channelIDs, sinceUnixMillis, userID, duration, groupingLocation +func (_m *ChannelStore) PostCountsByDuration(channelIDs []string, sinceUnixMillis int64, userID *string, duration model.PostCountGrouping, groupingLocation *time.Location) ([]*model.DurationPostCount, error) { + ret := _m.Called(channelIDs, sinceUnixMillis, userID, duration, groupingLocation) + + var r0 []*model.DurationPostCount + if rf, ok := ret.Get(0).(func([]string, int64, *string, model.PostCountGrouping, *time.Location) []*model.DurationPostCount); ok { + r0 = rf(channelIDs, sinceUnixMillis, userID, duration, groupingLocation) + } else { + if ret.Get(0) != nil { + r0 = ret.Get(0).([]*model.DurationPostCount) + } + } + + var r1 error + if rf, ok := ret.Get(1).(func([]string, int64, *string, model.PostCountGrouping, *time.Location) error); ok { + r1 = rf(channelIDs, sinceUnixMillis, userID, duration, groupingLocation) + } else { + r1 = ret.Error(1) + } + + return r0, r1 +} + // RemoveAllDeactivatedMembers provides a mock function with given fields: channelID func (_m *ChannelStore) RemoveAllDeactivatedMembers(channelID string) error { ret := _m.Called(channelID) @@ -1773,13 +1798,13 @@ func (_m *ChannelStore) ResetAllChannelSchemes() error { return r0 } -// Restore provides a mock function with given fields: channelID, time -func (_m *ChannelStore) Restore(channelID string, time int64) error { - ret := _m.Called(channelID, time) +// Restore provides a mock function with given fields: channelID, timestamp +func (_m *ChannelStore) Restore(channelID string, timestamp int64) error { + ret := _m.Called(channelID, timestamp) var r0 error if rf, ok := ret.Get(0).(func(string, int64) error); ok { - r0 = rf(channelID, time) + r0 = rf(channelID, timestamp) } else { r0 = ret.Error(0) } diff --git a/store/storetest/mocks/CommandStore.go b/store/storetest/mocks/CommandStore.go index b765ae21f4..146f89deb8 100644 --- a/store/storetest/mocks/CommandStore.go +++ b/store/storetest/mocks/CommandStore.go @@ -35,13 +35,13 @@ func (_m *CommandStore) AnalyticsCommandCount(teamID string) (int64, error) { return r0, r1 } -// Delete provides a mock function with given fields: commandID, time -func (_m *CommandStore) Delete(commandID string, time int64) error { - ret := _m.Called(commandID, time) +// Delete provides a mock function with given fields: commandID, timestamp +func (_m *CommandStore) Delete(commandID string, timestamp int64) error { + ret := _m.Called(commandID, timestamp) var r0 error if rf, ok := ret.Get(0).(func(string, int64) error); ok { - r0 = rf(commandID, time) + r0 = rf(commandID, timestamp) } else { r0 = ret.Error(0) } diff --git a/store/storetest/mocks/EmojiStore.go b/store/storetest/mocks/EmojiStore.go index 7e370dc459..116ac6daa3 100644 --- a/store/storetest/mocks/EmojiStore.go +++ b/store/storetest/mocks/EmojiStore.go @@ -16,13 +16,13 @@ type EmojiStore struct { mock.Mock } -// Delete provides a mock function with given fields: emoji, time -func (_m *EmojiStore) Delete(emoji *model.Emoji, time int64) error { - ret := _m.Called(emoji, time) +// Delete provides a mock function with given fields: emoji, timestamp +func (_m *EmojiStore) Delete(emoji *model.Emoji, timestamp int64) error { + ret := _m.Called(emoji, timestamp) var r0 error if rf, ok := ret.Get(0).(func(*model.Emoji, int64) error); ok { - r0 = rf(emoji, time) + r0 = rf(emoji, timestamp) } else { r0 = ret.Error(0) } diff --git a/store/storetest/mocks/PostStore.go b/store/storetest/mocks/PostStore.go index 819c723ece..a55cf77949 100644 --- a/store/storetest/mocks/PostStore.go +++ b/store/storetest/mocks/PostStore.go @@ -88,13 +88,13 @@ func (_m *PostStore) ClearCaches() { _m.Called() } -// Delete provides a mock function with given fields: postID, time, deleteByID -func (_m *PostStore) Delete(postID string, time int64, deleteByID string) error { - ret := _m.Called(postID, time, deleteByID) +// Delete provides a mock function with given fields: postID, timestamp, deleteByID +func (_m *PostStore) Delete(postID string, timestamp int64, deleteByID string) error { + ret := _m.Called(postID, timestamp, deleteByID) var r0 error if rf, ok := ret.Get(0).(func(string, int64, string) error); ok { - r0 = rf(postID, time, deleteByID) + r0 = rf(postID, timestamp, deleteByID) } else { r0 = ret.Error(0) } @@ -354,13 +354,13 @@ func (_m *PostStore) GetParentsForExportAfter(limit int, afterID string) ([]*mod return r0, r1 } -// GetPostAfterTime provides a mock function with given fields: channelID, time, collapsedThreads -func (_m *PostStore) GetPostAfterTime(channelID string, time int64, collapsedThreads bool) (*model.Post, error) { - ret := _m.Called(channelID, time, collapsedThreads) +// GetPostAfterTime provides a mock function with given fields: channelID, timestamp, collapsedThreads +func (_m *PostStore) GetPostAfterTime(channelID string, timestamp int64, collapsedThreads bool) (*model.Post, error) { + ret := _m.Called(channelID, timestamp, collapsedThreads) var r0 *model.Post if rf, ok := ret.Get(0).(func(string, int64, bool) *model.Post); ok { - r0 = rf(channelID, time, collapsedThreads) + r0 = rf(channelID, timestamp, collapsedThreads) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*model.Post) @@ -369,7 +369,7 @@ func (_m *PostStore) GetPostAfterTime(channelID string, time int64, collapsedThr var r1 error if rf, ok := ret.Get(1).(func(string, int64, bool) error); ok { - r1 = rf(channelID, time, collapsedThreads) + r1 = rf(channelID, timestamp, collapsedThreads) } else { r1 = ret.Error(1) } @@ -377,20 +377,20 @@ func (_m *PostStore) GetPostAfterTime(channelID string, time int64, collapsedThr return r0, r1 } -// GetPostIdAfterTime provides a mock function with given fields: channelID, time, collapsedThreads -func (_m *PostStore) GetPostIdAfterTime(channelID string, time int64, collapsedThreads bool) (string, error) { - ret := _m.Called(channelID, time, collapsedThreads) +// GetPostIdAfterTime provides a mock function with given fields: channelID, timestamp, collapsedThreads +func (_m *PostStore) GetPostIdAfterTime(channelID string, timestamp int64, collapsedThreads bool) (string, error) { + ret := _m.Called(channelID, timestamp, collapsedThreads) var r0 string if rf, ok := ret.Get(0).(func(string, int64, bool) string); ok { - r0 = rf(channelID, time, collapsedThreads) + r0 = rf(channelID, timestamp, collapsedThreads) } else { r0 = ret.Get(0).(string) } var r1 error if rf, ok := ret.Get(1).(func(string, int64, bool) error); ok { - r1 = rf(channelID, time, collapsedThreads) + r1 = rf(channelID, timestamp, collapsedThreads) } else { r1 = ret.Error(1) } @@ -398,20 +398,20 @@ func (_m *PostStore) GetPostIdAfterTime(channelID string, time int64, collapsedT return r0, r1 } -// GetPostIdBeforeTime provides a mock function with given fields: channelID, time, collapsedThreads -func (_m *PostStore) GetPostIdBeforeTime(channelID string, time int64, collapsedThreads bool) (string, error) { - ret := _m.Called(channelID, time, collapsedThreads) +// GetPostIdBeforeTime provides a mock function with given fields: channelID, timestamp, collapsedThreads +func (_m *PostStore) GetPostIdBeforeTime(channelID string, timestamp int64, collapsedThreads bool) (string, error) { + ret := _m.Called(channelID, timestamp, collapsedThreads) var r0 string if rf, ok := ret.Get(0).(func(string, int64, bool) string); ok { - r0 = rf(channelID, time, collapsedThreads) + r0 = rf(channelID, timestamp, collapsedThreads) } else { r0 = ret.Get(0).(string) } var r1 error if rf, ok := ret.Get(1).(func(string, int64, bool) error); ok { - r1 = rf(channelID, time, collapsedThreads) + r1 = rf(channelID, timestamp, collapsedThreads) } else { r1 = ret.Error(1) } @@ -534,13 +534,13 @@ func (_m *PostStore) GetPostsByIds(postIds []string) ([]*model.Post, error) { return r0, r1 } -// GetPostsCreatedAt provides a mock function with given fields: channelID, time -func (_m *PostStore) GetPostsCreatedAt(channelID string, time int64) ([]*model.Post, error) { - ret := _m.Called(channelID, time) +// GetPostsCreatedAt provides a mock function with given fields: channelID, timestamp +func (_m *PostStore) GetPostsCreatedAt(channelID string, timestamp int64) ([]*model.Post, error) { + ret := _m.Called(channelID, timestamp) var r0 []*model.Post if rf, ok := ret.Get(0).(func(string, int64) []*model.Post); ok { - r0 = rf(channelID, time) + r0 = rf(channelID, timestamp) } else { if ret.Get(0) != nil { r0 = ret.Get(0).([]*model.Post) @@ -549,7 +549,7 @@ func (_m *PostStore) GetPostsCreatedAt(channelID string, time int64) ([]*model.P var r1 error if rf, ok := ret.Get(1).(func(string, int64) error); ok { - r1 = rf(channelID, time) + r1 = rf(channelID, timestamp) } else { r1 = ret.Error(1) } diff --git a/store/storetest/mocks/SessionStore.go b/store/storetest/mocks/SessionStore.go index f980c63c7b..7d5be8a3fb 100644 --- a/store/storetest/mocks/SessionStore.go +++ b/store/storetest/mocks/SessionStore.go @@ -264,13 +264,13 @@ func (_m *SessionStore) UpdateExpiredNotify(sessionid string, notified bool) err return r0 } -// UpdateExpiresAt provides a mock function with given fields: sessionID, time -func (_m *SessionStore) UpdateExpiresAt(sessionID string, time int64) error { - ret := _m.Called(sessionID, time) +// UpdateExpiresAt provides a mock function with given fields: sessionID, timestamp +func (_m *SessionStore) UpdateExpiresAt(sessionID string, timestamp int64) error { + ret := _m.Called(sessionID, timestamp) var r0 error if rf, ok := ret.Get(0).(func(string, int64) error); ok { - r0 = rf(sessionID, time) + r0 = rf(sessionID, timestamp) } else { r0 = ret.Error(0) } @@ -278,13 +278,13 @@ func (_m *SessionStore) UpdateExpiresAt(sessionID string, time int64) error { return r0 } -// UpdateLastActivityAt provides a mock function with given fields: sessionID, time -func (_m *SessionStore) UpdateLastActivityAt(sessionID string, time int64) error { - ret := _m.Called(sessionID, time) +// UpdateLastActivityAt provides a mock function with given fields: sessionID, timestamp +func (_m *SessionStore) UpdateLastActivityAt(sessionID string, timestamp int64) error { + ret := _m.Called(sessionID, timestamp) var r0 error if rf, ok := ret.Get(0).(func(string, int64) error); ok { - r0 = rf(sessionID, time) + r0 = rf(sessionID, timestamp) } else { r0 = ret.Error(0) } diff --git a/store/storetest/mocks/UserStore.go b/store/storetest/mocks/UserStore.go index 9b314bb62b..64063378a9 100644 --- a/store/storetest/mocks/UserStore.go +++ b/store/storetest/mocks/UserStore.go @@ -18,20 +18,20 @@ type UserStore struct { mock.Mock } -// AnalyticsActiveCount provides a mock function with given fields: time, options -func (_m *UserStore) AnalyticsActiveCount(time int64, options model.UserCountOptions) (int64, error) { - ret := _m.Called(time, options) +// AnalyticsActiveCount provides a mock function with given fields: timestamp, options +func (_m *UserStore) AnalyticsActiveCount(timestamp int64, options model.UserCountOptions) (int64, error) { + ret := _m.Called(timestamp, options) var r0 int64 if rf, ok := ret.Get(0).(func(int64, model.UserCountOptions) int64); ok { - r0 = rf(time, options) + r0 = rf(timestamp, options) } else { r0 = ret.Get(0).(int64) } var r1 error if rf, ok := ret.Get(1).(func(int64, model.UserCountOptions) error); ok { - r1 = rf(time, options) + r1 = rf(timestamp, options) } else { r1 = ret.Error(1) } diff --git a/store/storetest/mocks/WebhookStore.go b/store/storetest/mocks/WebhookStore.go index a2da280361..5abfc36738 100644 --- a/store/storetest/mocks/WebhookStore.go +++ b/store/storetest/mocks/WebhookStore.go @@ -61,13 +61,13 @@ func (_m *WebhookStore) ClearCaches() { _m.Called() } -// DeleteIncoming provides a mock function with given fields: webhookID, time -func (_m *WebhookStore) DeleteIncoming(webhookID string, time int64) error { - ret := _m.Called(webhookID, time) +// DeleteIncoming provides a mock function with given fields: webhookID, timestamp +func (_m *WebhookStore) DeleteIncoming(webhookID string, timestamp int64) error { + ret := _m.Called(webhookID, timestamp) var r0 error if rf, ok := ret.Get(0).(func(string, int64) error); ok { - r0 = rf(webhookID, time) + r0 = rf(webhookID, timestamp) } else { r0 = ret.Error(0) } @@ -75,13 +75,13 @@ func (_m *WebhookStore) DeleteIncoming(webhookID string, time int64) error { return r0 } -// DeleteOutgoing provides a mock function with given fields: webhookID, time -func (_m *WebhookStore) DeleteOutgoing(webhookID string, time int64) error { - ret := _m.Called(webhookID, time) +// DeleteOutgoing provides a mock function with given fields: webhookID, timestamp +func (_m *WebhookStore) DeleteOutgoing(webhookID string, timestamp int64) error { + ret := _m.Called(webhookID, timestamp) var r0 error if rf, ok := ret.Get(0).(func(string, int64) error); ok { - r0 = rf(webhookID, time) + r0 = rf(webhookID, timestamp) } else { r0 = ret.Error(0) } diff --git a/store/storetest/post_store.go b/store/storetest/post_store.go index 69973c6675..1e7bb7b386 100644 --- a/store/storetest/post_store.go +++ b/store/storetest/post_store.go @@ -36,7 +36,7 @@ func TestPostStore(t *testing.T, ss store.Store, s SqlStore) { t.Run("GetPosts", func(t *testing.T) { testPostStoreGetPosts(t, ss) }) t.Run("GetPostBeforeAfter", func(t *testing.T) { testPostStoreGetPostBeforeAfter(t, ss) }) t.Run("UserCountsWithPostsByDay", func(t *testing.T) { testUserCountsWithPostsByDay(t, ss) }) - t.Run("PostCountsByDay", func(t *testing.T) { testPostCountsByDay(t, ss) }) + t.Run("PostCountsByDuration", func(t *testing.T) { testPostCountsByDay(t, ss) }) t.Run("GetFlaggedPostsForTeam", func(t *testing.T) { testPostStoreGetFlaggedPostsForTeam(t, ss, s) }) t.Run("GetFlaggedPosts", func(t *testing.T) { testPostStoreGetFlaggedPosts(t, ss) }) t.Run("GetFlaggedPostsForChannel", func(t *testing.T) { testPostStoreGetFlaggedPostsForChannel(t, ss) }) diff --git a/store/timerlayer/timerlayer.go b/store/timerlayer/timerlayer.go index 6d57bed37c..8fc2af7d5e 100644 --- a/store/timerlayer/timerlayer.go +++ b/store/timerlayer/timerlayer.go @@ -8,7 +8,7 @@ package timerlayer import ( "context" - timemodule "time" + "time" "github.com/mattermost/mattermost-server/v6/einterfaces" "github.com/mattermost/mattermost-server/v6/model" @@ -391,11 +391,11 @@ type TimerLayerWebhookStore struct { } func (s *TimerLayerAuditStore) Get(user_id string, offset int, limit int) (model.Audits, error) { - start := timemodule.Now() + start := time.Now() result, err := s.AuditStore.Get(user_id, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -407,11 +407,11 @@ func (s *TimerLayerAuditStore) Get(user_id string, offset int, limit int) (model } func (s *TimerLayerAuditStore) PermanentDeleteByUser(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.AuditStore.PermanentDeleteByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -423,11 +423,11 @@ func (s *TimerLayerAuditStore) PermanentDeleteByUser(userID string) error { } func (s *TimerLayerAuditStore) Save(audit *model.Audit) error { - start := timemodule.Now() + start := time.Now() err := s.AuditStore.Save(audit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -439,11 +439,11 @@ func (s *TimerLayerAuditStore) Save(audit *model.Audit) error { } func (s *TimerLayerBotStore) Get(userID string, includeDeleted bool) (*model.Bot, error) { - start := timemodule.Now() + start := time.Now() result, err := s.BotStore.Get(userID, includeDeleted) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -455,11 +455,11 @@ func (s *TimerLayerBotStore) Get(userID string, includeDeleted bool) (*model.Bot } func (s *TimerLayerBotStore) GetAll(options *model.BotGetOptions) ([]*model.Bot, error) { - start := timemodule.Now() + start := time.Now() result, err := s.BotStore.GetAll(options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -471,11 +471,11 @@ func (s *TimerLayerBotStore) GetAll(options *model.BotGetOptions) ([]*model.Bot, } func (s *TimerLayerBotStore) PermanentDelete(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.BotStore.PermanentDelete(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -487,11 +487,11 @@ func (s *TimerLayerBotStore) PermanentDelete(userID string) error { } func (s *TimerLayerBotStore) Save(bot *model.Bot) (*model.Bot, error) { - start := timemodule.Now() + start := time.Now() result, err := s.BotStore.Save(bot) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -503,11 +503,11 @@ func (s *TimerLayerBotStore) Save(bot *model.Bot) (*model.Bot, error) { } func (s *TimerLayerBotStore) Update(bot *model.Bot) (*model.Bot, error) { - start := timemodule.Now() + start := time.Now() result, err := s.BotStore.Update(bot) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -519,11 +519,11 @@ func (s *TimerLayerBotStore) Update(bot *model.Bot) (*model.Bot, error) { } func (s *TimerLayerChannelStore) AnalyticsDeletedTypeCount(teamID string, channelType model.ChannelType) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.AnalyticsDeletedTypeCount(teamID, channelType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -535,11 +535,11 @@ func (s *TimerLayerChannelStore) AnalyticsDeletedTypeCount(teamID string, channe } func (s *TimerLayerChannelStore) AnalyticsTypeCount(teamID string, channelType model.ChannelType) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.AnalyticsTypeCount(teamID, channelType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -551,11 +551,11 @@ func (s *TimerLayerChannelStore) AnalyticsTypeCount(teamID string, channelType m } func (s *TimerLayerChannelStore) Autocomplete(userID string, term string, includeDeleted bool, isGuest bool) (model.ChannelListWithTeamData, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.Autocomplete(userID, term, includeDeleted, isGuest) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -567,11 +567,11 @@ func (s *TimerLayerChannelStore) Autocomplete(userID string, term string, includ } func (s *TimerLayerChannelStore) AutocompleteInTeam(teamID string, userID string, term string, includeDeleted bool, isGuest bool) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.AutocompleteInTeam(teamID, userID, term, includeDeleted, isGuest) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -583,11 +583,11 @@ func (s *TimerLayerChannelStore) AutocompleteInTeam(teamID string, userID string } func (s *TimerLayerChannelStore) AutocompleteInTeamForSearch(teamID string, userID string, term string, includeDeleted bool) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.AutocompleteInTeamForSearch(teamID, userID, term, includeDeleted) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -599,11 +599,11 @@ func (s *TimerLayerChannelStore) AutocompleteInTeamForSearch(teamID string, user } func (s *TimerLayerChannelStore) ClearAllCustomRoleAssignments() error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.ClearAllCustomRoleAssignments() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -615,11 +615,11 @@ func (s *TimerLayerChannelStore) ClearAllCustomRoleAssignments() error { } func (s *TimerLayerChannelStore) ClearCaches() { - start := timemodule.Now() + start := time.Now() s.ChannelStore.ClearCaches() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -630,11 +630,11 @@ func (s *TimerLayerChannelStore) ClearCaches() { } func (s *TimerLayerChannelStore) ClearSidebarOnTeamLeave(userID string, teamID string) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.ClearSidebarOnTeamLeave(userID, teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -646,11 +646,11 @@ func (s *TimerLayerChannelStore) ClearSidebarOnTeamLeave(userID string, teamID s } func (s *TimerLayerChannelStore) CountPostsAfter(channelID string, timestamp int64, userID string) (int, int, error) { - start := timemodule.Now() + start := time.Now() result, resultVar1, err := s.ChannelStore.CountPostsAfter(channelID, timestamp, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -662,11 +662,11 @@ func (s *TimerLayerChannelStore) CountPostsAfter(channelID string, timestamp int } func (s *TimerLayerChannelStore) CreateDirectChannel(userID *model.User, otherUserID *model.User, channelOptions ...model.ChannelOption) (*model.Channel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.CreateDirectChannel(userID, otherUserID, channelOptions...) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -678,11 +678,11 @@ func (s *TimerLayerChannelStore) CreateDirectChannel(userID *model.User, otherUs } func (s *TimerLayerChannelStore) CreateInitialSidebarCategories(userID string, teamID string) (*model.OrderedSidebarCategories, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.CreateInitialSidebarCategories(userID, teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -694,11 +694,11 @@ func (s *TimerLayerChannelStore) CreateInitialSidebarCategories(userID string, t } func (s *TimerLayerChannelStore) CreateSidebarCategory(userID string, teamID string, newCategory *model.SidebarCategoryWithChannels) (*model.SidebarCategoryWithChannels, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.CreateSidebarCategory(userID, teamID, newCategory) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -709,12 +709,12 @@ func (s *TimerLayerChannelStore) CreateSidebarCategory(userID string, teamID str return result, err } -func (s *TimerLayerChannelStore) Delete(channelID string, time int64) error { - start := timemodule.Now() +func (s *TimerLayerChannelStore) Delete(channelID string, timestamp int64) error { + start := time.Now() - err := s.ChannelStore.Delete(channelID, time) + err := s.ChannelStore.Delete(channelID, timestamp) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -726,11 +726,11 @@ func (s *TimerLayerChannelStore) Delete(channelID string, time int64) error { } func (s *TimerLayerChannelStore) DeleteSidebarCategory(categoryID string) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.DeleteSidebarCategory(categoryID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -742,11 +742,11 @@ func (s *TimerLayerChannelStore) DeleteSidebarCategory(categoryID string) error } func (s *TimerLayerChannelStore) DeleteSidebarChannelsByPreferences(preferences model.Preferences) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.DeleteSidebarChannelsByPreferences(preferences) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -758,11 +758,11 @@ func (s *TimerLayerChannelStore) DeleteSidebarChannelsByPreferences(preferences } func (s *TimerLayerChannelStore) Get(id string, allowFromCache bool) (*model.Channel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.Get(id, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -774,11 +774,11 @@ func (s *TimerLayerChannelStore) Get(id string, allowFromCache bool) (*model.Cha } func (s *TimerLayerChannelStore) GetAll(teamID string) ([]*model.Channel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetAll(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -790,11 +790,11 @@ func (s *TimerLayerChannelStore) GetAll(teamID string) ([]*model.Channel, error) } func (s *TimerLayerChannelStore) GetAllChannelMembersById(id string) ([]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetAllChannelMembersById(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -806,11 +806,11 @@ func (s *TimerLayerChannelStore) GetAllChannelMembersById(id string) ([]string, } func (s *TimerLayerChannelStore) GetAllChannelMembersForUser(userID string, allowFromCache bool, includeDeleted bool) (map[string]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetAllChannelMembersForUser(userID, allowFromCache, includeDeleted) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -822,11 +822,11 @@ func (s *TimerLayerChannelStore) GetAllChannelMembersForUser(userID string, allo } func (s *TimerLayerChannelStore) GetAllChannelMembersNotifyPropsForChannel(channelID string, allowFromCache bool) (map[string]model.StringMap, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetAllChannelMembersNotifyPropsForChannel(channelID, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -838,11 +838,11 @@ func (s *TimerLayerChannelStore) GetAllChannelMembersNotifyPropsForChannel(chann } func (s *TimerLayerChannelStore) GetAllChannels(page int, perPage int, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetAllChannels(page, perPage, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -854,11 +854,11 @@ func (s *TimerLayerChannelStore) GetAllChannels(page int, perPage int, opts stor } func (s *TimerLayerChannelStore) GetAllChannelsCount(opts store.ChannelSearchOpts) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetAllChannelsCount(opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -870,11 +870,11 @@ func (s *TimerLayerChannelStore) GetAllChannelsCount(opts store.ChannelSearchOpt } func (s *TimerLayerChannelStore) GetAllChannelsForExportAfter(limit int, afterID string) ([]*model.ChannelForExport, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetAllChannelsForExportAfter(limit, afterID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -886,11 +886,11 @@ func (s *TimerLayerChannelStore) GetAllChannelsForExportAfter(limit int, afterID } func (s *TimerLayerChannelStore) GetAllDirectChannelsForExportAfter(limit int, afterID string) ([]*model.DirectChannelForExport, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetAllDirectChannelsForExportAfter(limit, afterID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -902,11 +902,11 @@ func (s *TimerLayerChannelStore) GetAllDirectChannelsForExportAfter(limit int, a } func (s *TimerLayerChannelStore) GetByName(team_id string, name string, allowFromCache bool) (*model.Channel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetByName(team_id, name, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -918,11 +918,11 @@ func (s *TimerLayerChannelStore) GetByName(team_id string, name string, allowFro } func (s *TimerLayerChannelStore) GetByNameIncludeDeleted(team_id string, name string, allowFromCache bool) (*model.Channel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetByNameIncludeDeleted(team_id, name, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -934,11 +934,11 @@ func (s *TimerLayerChannelStore) GetByNameIncludeDeleted(team_id string, name st } func (s *TimerLayerChannelStore) GetByNames(team_id string, names []string, allowFromCache bool) ([]*model.Channel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetByNames(team_id, names, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -950,11 +950,11 @@ func (s *TimerLayerChannelStore) GetByNames(team_id string, names []string, allo } func (s *TimerLayerChannelStore) GetChannelCounts(teamID string, userID string) (*model.ChannelCounts, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetChannelCounts(teamID, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -966,11 +966,11 @@ func (s *TimerLayerChannelStore) GetChannelCounts(teamID string, userID string) } func (s *TimerLayerChannelStore) GetChannelMembersForExport(userID string, teamID string) ([]*model.ChannelMemberForExport, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetChannelMembersForExport(userID, teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -982,11 +982,11 @@ func (s *TimerLayerChannelStore) GetChannelMembersForExport(userID string, teamI } func (s *TimerLayerChannelStore) GetChannelMembersTimezones(channelID string) ([]model.StringMap, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetChannelMembersTimezones(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -998,11 +998,11 @@ func (s *TimerLayerChannelStore) GetChannelMembersTimezones(channelID string) ([ } func (s *TimerLayerChannelStore) GetChannelUnread(channelID string, userID string) (*model.ChannelUnread, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetChannelUnread(channelID, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1014,11 +1014,11 @@ func (s *TimerLayerChannelStore) GetChannelUnread(channelID string, userID strin } func (s *TimerLayerChannelStore) GetChannels(teamID string, userID string, opts *model.ChannelSearchOpts) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetChannels(teamID, userID, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1030,11 +1030,11 @@ func (s *TimerLayerChannelStore) GetChannels(teamID string, userID string, opts } func (s *TimerLayerChannelStore) GetChannelsBatchForIndexing(startTime int64, startChannelID string, limit int) ([]*model.Channel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetChannelsBatchForIndexing(startTime, startChannelID, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1046,11 +1046,11 @@ func (s *TimerLayerChannelStore) GetChannelsBatchForIndexing(startTime int64, st } func (s *TimerLayerChannelStore) GetChannelsByIds(channelIds []string, includeDeleted bool) ([]*model.Channel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetChannelsByIds(channelIds, includeDeleted) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1062,11 +1062,11 @@ func (s *TimerLayerChannelStore) GetChannelsByIds(channelIds []string, includeDe } func (s *TimerLayerChannelStore) GetChannelsByScheme(schemeID string, offset int, limit int) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetChannelsByScheme(schemeID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1078,11 +1078,11 @@ func (s *TimerLayerChannelStore) GetChannelsByScheme(schemeID string, offset int } func (s *TimerLayerChannelStore) GetChannelsByUser(userID string, includeDeleted bool, lastDeleteAt int, pageSize int, fromChannelID string) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetChannelsByUser(userID, includeDeleted, lastDeleteAt, pageSize, fromChannelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1094,11 +1094,11 @@ func (s *TimerLayerChannelStore) GetChannelsByUser(userID string, includeDeleted } func (s *TimerLayerChannelStore) GetChannelsWithCursor(teamId string, userId string, opts *model.ChannelSearchOpts, afterChannelID string) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetChannelsWithCursor(teamId, userId, opts, afterChannelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1110,11 +1110,11 @@ func (s *TimerLayerChannelStore) GetChannelsWithCursor(teamId string, userId str } func (s *TimerLayerChannelStore) GetChannelsWithTeamDataByIds(channelIds []string, includeDeleted bool) ([]*model.ChannelWithTeamData, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetChannelsWithTeamDataByIds(channelIds, includeDeleted) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1126,11 +1126,11 @@ func (s *TimerLayerChannelStore) GetChannelsWithTeamDataByIds(channelIds []strin } func (s *TimerLayerChannelStore) GetDeleted(team_id string, offset int, limit int, userID string) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetDeleted(team_id, offset, limit, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1142,11 +1142,11 @@ func (s *TimerLayerChannelStore) GetDeleted(team_id string, offset int, limit in } func (s *TimerLayerChannelStore) GetDeletedByName(team_id string, name string) (*model.Channel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetDeletedByName(team_id, name) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1158,11 +1158,11 @@ func (s *TimerLayerChannelStore) GetDeletedByName(team_id string, name string) ( } func (s *TimerLayerChannelStore) GetFileCount(channelID string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetFileCount(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1174,11 +1174,11 @@ func (s *TimerLayerChannelStore) GetFileCount(channelID string) (int64, error) { } func (s *TimerLayerChannelStore) GetForPost(postID string) (*model.Channel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetForPost(postID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1190,11 +1190,11 @@ func (s *TimerLayerChannelStore) GetForPost(postID string) (*model.Channel, erro } func (s *TimerLayerChannelStore) GetGuestCount(channelID string, allowFromCache bool) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetGuestCount(channelID, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1206,11 +1206,11 @@ func (s *TimerLayerChannelStore) GetGuestCount(channelID string, allowFromCache } func (s *TimerLayerChannelStore) GetMany(ids []string, allowFromCache bool) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetMany(ids, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1222,11 +1222,11 @@ func (s *TimerLayerChannelStore) GetMany(ids []string, allowFromCache bool) (mod } func (s *TimerLayerChannelStore) GetMember(ctx context.Context, channelID string, userID string) (*model.ChannelMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetMember(ctx, channelID, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1238,11 +1238,11 @@ func (s *TimerLayerChannelStore) GetMember(ctx context.Context, channelID string } func (s *TimerLayerChannelStore) GetMemberCount(channelID string, allowFromCache bool) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetMemberCount(channelID, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1254,11 +1254,11 @@ func (s *TimerLayerChannelStore) GetMemberCount(channelID string, allowFromCache } func (s *TimerLayerChannelStore) GetMemberCountFromCache(channelID string) int64 { - start := timemodule.Now() + start := time.Now() result := s.ChannelStore.GetMemberCountFromCache(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -1270,11 +1270,11 @@ func (s *TimerLayerChannelStore) GetMemberCountFromCache(channelID string) int64 } func (s *TimerLayerChannelStore) GetMemberCountsByGroup(ctx context.Context, channelID string, includeTimezones bool) ([]*model.ChannelMemberCountByGroup, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetMemberCountsByGroup(ctx, channelID, includeTimezones) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1286,11 +1286,11 @@ func (s *TimerLayerChannelStore) GetMemberCountsByGroup(ctx context.Context, cha } func (s *TimerLayerChannelStore) GetMemberForPost(postID string, userID string) (*model.ChannelMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetMemberForPost(postID, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1302,11 +1302,11 @@ func (s *TimerLayerChannelStore) GetMemberForPost(postID string, userID string) } func (s *TimerLayerChannelStore) GetMembers(channelID string, offset int, limit int) (model.ChannelMembers, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetMembers(channelID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1318,11 +1318,11 @@ func (s *TimerLayerChannelStore) GetMembers(channelID string, offset int, limit } func (s *TimerLayerChannelStore) GetMembersByChannelIds(channelIds []string, userID string) (model.ChannelMembers, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetMembersByChannelIds(channelIds, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1334,11 +1334,11 @@ func (s *TimerLayerChannelStore) GetMembersByChannelIds(channelIds []string, use } func (s *TimerLayerChannelStore) GetMembersByIds(channelID string, userIds []string) (model.ChannelMembers, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetMembersByIds(channelID, userIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1350,11 +1350,11 @@ func (s *TimerLayerChannelStore) GetMembersByIds(channelID string, userIds []str } func (s *TimerLayerChannelStore) GetMembersForUser(teamID string, userID string) (model.ChannelMembers, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetMembersForUser(teamID, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1366,11 +1366,11 @@ func (s *TimerLayerChannelStore) GetMembersForUser(teamID string, userID string) } func (s *TimerLayerChannelStore) GetMembersForUserWithCursor(userID string, teamID string, opts *store.ChannelMemberGraphQLSearchOpts) (model.ChannelMembers, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetMembersForUserWithCursor(userID, teamID, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1382,11 +1382,11 @@ func (s *TimerLayerChannelStore) GetMembersForUserWithCursor(userID string, team } func (s *TimerLayerChannelStore) GetMembersForUserWithPagination(userID string, page int, perPage int) (model.ChannelMembersWithTeamData, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetMembersForUserWithPagination(userID, page, perPage) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1398,11 +1398,11 @@ func (s *TimerLayerChannelStore) GetMembersForUserWithPagination(userID string, } func (s *TimerLayerChannelStore) GetMembersInfoByChannelIds(channelIDs []string) (map[string][]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetMembersInfoByChannelIds(channelIDs) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1414,11 +1414,11 @@ func (s *TimerLayerChannelStore) GetMembersInfoByChannelIds(channelIDs []string) } func (s *TimerLayerChannelStore) GetMoreChannels(teamID string, userID string, offset int, limit int) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetMoreChannels(teamID, userID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1430,11 +1430,11 @@ func (s *TimerLayerChannelStore) GetMoreChannels(teamID string, userID string, o } func (s *TimerLayerChannelStore) GetPinnedPostCount(channelID string, allowFromCache bool) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetPinnedPostCount(channelID, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1446,11 +1446,11 @@ func (s *TimerLayerChannelStore) GetPinnedPostCount(channelID string, allowFromC } func (s *TimerLayerChannelStore) GetPinnedPosts(channelID string) (*model.PostList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetPinnedPosts(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1462,11 +1462,11 @@ func (s *TimerLayerChannelStore) GetPinnedPosts(channelID string) (*model.PostLi } func (s *TimerLayerChannelStore) GetPrivateChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetPrivateChannelsForTeam(teamID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1478,11 +1478,11 @@ func (s *TimerLayerChannelStore) GetPrivateChannelsForTeam(teamID string, offset } func (s *TimerLayerChannelStore) GetPublicChannelsByIdsForTeam(teamID string, channelIds []string) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetPublicChannelsByIdsForTeam(teamID, channelIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1494,11 +1494,11 @@ func (s *TimerLayerChannelStore) GetPublicChannelsByIdsForTeam(teamID string, ch } func (s *TimerLayerChannelStore) GetPublicChannelsForTeam(teamID string, offset int, limit int) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetPublicChannelsForTeam(teamID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1510,11 +1510,11 @@ func (s *TimerLayerChannelStore) GetPublicChannelsForTeam(teamID string, offset } func (s *TimerLayerChannelStore) GetSidebarCategories(userID string, teamID string) (*model.OrderedSidebarCategories, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetSidebarCategories(userID, teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1526,11 +1526,11 @@ func (s *TimerLayerChannelStore) GetSidebarCategories(userID string, teamID stri } func (s *TimerLayerChannelStore) GetSidebarCategory(categoryID string) (*model.SidebarCategoryWithChannels, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetSidebarCategory(categoryID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1542,11 +1542,11 @@ func (s *TimerLayerChannelStore) GetSidebarCategory(categoryID string) (*model.S } func (s *TimerLayerChannelStore) GetSidebarCategoryOrder(userID string, teamID string) ([]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetSidebarCategoryOrder(userID, teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1558,11 +1558,11 @@ func (s *TimerLayerChannelStore) GetSidebarCategoryOrder(userID string, teamID s } func (s *TimerLayerChannelStore) GetTeamChannels(teamID string) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetTeamChannels(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1574,11 +1574,11 @@ func (s *TimerLayerChannelStore) GetTeamChannels(teamID string) (model.ChannelLi } func (s *TimerLayerChannelStore) GetTeamForChannel(channelID string) (*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetTeamForChannel(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1590,11 +1590,11 @@ func (s *TimerLayerChannelStore) GetTeamForChannel(channelID string) (*model.Tea } func (s *TimerLayerChannelStore) GetTeamMembersForChannel(channelID string) ([]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetTeamMembersForChannel(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1606,11 +1606,11 @@ func (s *TimerLayerChannelStore) GetTeamMembersForChannel(channelID string) ([]s } func (s *TimerLayerChannelStore) GetTopChannelsForTeamSince(teamID string, userID string, since int64, offset int, limit int) (*model.TopChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetTopChannelsForTeamSince(teamID, userID, since, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1622,11 +1622,11 @@ func (s *TimerLayerChannelStore) GetTopChannelsForTeamSince(teamID string, userI } func (s *TimerLayerChannelStore) GetTopChannelsForUserSince(userID string, teamID string, since int64, offset int, limit int) (*model.TopChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GetTopChannelsForUserSince(userID, teamID, since, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1638,11 +1638,11 @@ func (s *TimerLayerChannelStore) GetTopChannelsForUserSince(userID string, teamI } func (s *TimerLayerChannelStore) GroupSyncedChannelCount() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.GroupSyncedChannelCount() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1654,11 +1654,11 @@ func (s *TimerLayerChannelStore) GroupSyncedChannelCount() (int64, error) { } func (s *TimerLayerChannelStore) IncrementMentionCount(channelID string, userIDs []string, isRoot bool) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.IncrementMentionCount(channelID, userIDs, isRoot) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1670,11 +1670,11 @@ func (s *TimerLayerChannelStore) IncrementMentionCount(channelID string, userIDs } func (s *TimerLayerChannelStore) InvalidateAllChannelMembersForUser(userID string) { - start := timemodule.Now() + start := time.Now() s.ChannelStore.InvalidateAllChannelMembersForUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -1685,11 +1685,11 @@ func (s *TimerLayerChannelStore) InvalidateAllChannelMembersForUser(userID strin } func (s *TimerLayerChannelStore) InvalidateCacheForChannelMembersNotifyProps(channelID string) { - start := timemodule.Now() + start := time.Now() s.ChannelStore.InvalidateCacheForChannelMembersNotifyProps(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -1700,11 +1700,11 @@ func (s *TimerLayerChannelStore) InvalidateCacheForChannelMembersNotifyProps(cha } func (s *TimerLayerChannelStore) InvalidateChannel(id string) { - start := timemodule.Now() + start := time.Now() s.ChannelStore.InvalidateChannel(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -1715,11 +1715,11 @@ func (s *TimerLayerChannelStore) InvalidateChannel(id string) { } func (s *TimerLayerChannelStore) InvalidateChannelByName(teamID string, name string) { - start := timemodule.Now() + start := time.Now() s.ChannelStore.InvalidateChannelByName(teamID, name) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -1730,11 +1730,11 @@ func (s *TimerLayerChannelStore) InvalidateChannelByName(teamID string, name str } func (s *TimerLayerChannelStore) InvalidateGuestCount(channelID string) { - start := timemodule.Now() + start := time.Now() s.ChannelStore.InvalidateGuestCount(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -1745,11 +1745,11 @@ func (s *TimerLayerChannelStore) InvalidateGuestCount(channelID string) { } func (s *TimerLayerChannelStore) InvalidateMemberCount(channelID string) { - start := timemodule.Now() + start := time.Now() s.ChannelStore.InvalidateMemberCount(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -1760,11 +1760,11 @@ func (s *TimerLayerChannelStore) InvalidateMemberCount(channelID string) { } func (s *TimerLayerChannelStore) InvalidatePinnedPostCount(channelID string) { - start := timemodule.Now() + start := time.Now() s.ChannelStore.InvalidatePinnedPostCount(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -1775,11 +1775,11 @@ func (s *TimerLayerChannelStore) InvalidatePinnedPostCount(channelID string) { } func (s *TimerLayerChannelStore) IsUserInChannelUseCache(userID string, channelID string) bool { - start := timemodule.Now() + start := time.Now() result := s.ChannelStore.IsUserInChannelUseCache(userID, channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -1791,11 +1791,11 @@ func (s *TimerLayerChannelStore) IsUserInChannelUseCache(userID string, channelI } func (s *TimerLayerChannelStore) MigrateChannelMembers(fromChannelID string, fromUserID string) (map[string]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.MigrateChannelMembers(fromChannelID, fromUserID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1807,11 +1807,11 @@ func (s *TimerLayerChannelStore) MigrateChannelMembers(fromChannelID string, fro } func (s *TimerLayerChannelStore) PermanentDelete(channelID string) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.PermanentDelete(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1823,11 +1823,11 @@ func (s *TimerLayerChannelStore) PermanentDelete(channelID string) error { } func (s *TimerLayerChannelStore) PermanentDeleteByTeam(teamID string) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.PermanentDeleteByTeam(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1839,11 +1839,11 @@ func (s *TimerLayerChannelStore) PermanentDeleteByTeam(teamID string) error { } func (s *TimerLayerChannelStore) PermanentDeleteMembersByChannel(channelID string) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.PermanentDeleteMembersByChannel(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1855,11 +1855,11 @@ func (s *TimerLayerChannelStore) PermanentDeleteMembersByChannel(channelID strin } func (s *TimerLayerChannelStore) PermanentDeleteMembersByUser(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.PermanentDeleteMembersByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1870,12 +1870,28 @@ func (s *TimerLayerChannelStore) PermanentDeleteMembersByUser(userID string) err return err } +func (s *TimerLayerChannelStore) PostCountsByDuration(channelIDs []string, sinceUnixMillis int64, userID *string, duration model.PostCountGrouping, groupingLocation *time.Location) ([]*model.DurationPostCount, error) { + start := time.Now() + + result, err := s.ChannelStore.PostCountsByDuration(channelIDs, sinceUnixMillis, userID, duration, groupingLocation) + + elapsed := float64(time.Since(start)) / float64(time.Second) + if s.Root.Metrics != nil { + success := "false" + if err == nil { + success = "true" + } + s.Root.Metrics.ObserveStoreMethodDuration("ChannelStore.PostCountsByDuration", success, elapsed) + } + return result, err +} + func (s *TimerLayerChannelStore) RemoveAllDeactivatedMembers(channelID string) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.RemoveAllDeactivatedMembers(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1887,11 +1903,11 @@ func (s *TimerLayerChannelStore) RemoveAllDeactivatedMembers(channelID string) e } func (s *TimerLayerChannelStore) RemoveMember(channelID string, userID string) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.RemoveMember(channelID, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1903,11 +1919,11 @@ func (s *TimerLayerChannelStore) RemoveMember(channelID string, userID string) e } func (s *TimerLayerChannelStore) RemoveMembers(channelID string, userIds []string) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.RemoveMembers(channelID, userIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1919,11 +1935,11 @@ func (s *TimerLayerChannelStore) RemoveMembers(channelID string, userIds []strin } func (s *TimerLayerChannelStore) ResetAllChannelSchemes() error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.ResetAllChannelSchemes() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1934,12 +1950,12 @@ func (s *TimerLayerChannelStore) ResetAllChannelSchemes() error { return err } -func (s *TimerLayerChannelStore) Restore(channelID string, time int64) error { - start := timemodule.Now() +func (s *TimerLayerChannelStore) Restore(channelID string, timestamp int64) error { + start := time.Now() - err := s.ChannelStore.Restore(channelID, time) + err := s.ChannelStore.Restore(channelID, timestamp) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1951,11 +1967,11 @@ func (s *TimerLayerChannelStore) Restore(channelID string, time int64) error { } func (s *TimerLayerChannelStore) Save(channel *model.Channel, maxChannelsPerTeam int64) (*model.Channel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.Save(channel, maxChannelsPerTeam) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1967,11 +1983,11 @@ func (s *TimerLayerChannelStore) Save(channel *model.Channel, maxChannelsPerTeam } func (s *TimerLayerChannelStore) SaveDirectChannel(channel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) (*model.Channel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.SaveDirectChannel(channel, member1, member2) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1983,11 +1999,11 @@ func (s *TimerLayerChannelStore) SaveDirectChannel(channel *model.Channel, membe } func (s *TimerLayerChannelStore) SaveMember(member *model.ChannelMember) (*model.ChannelMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.SaveMember(member) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -1999,11 +2015,11 @@ func (s *TimerLayerChannelStore) SaveMember(member *model.ChannelMember) (*model } func (s *TimerLayerChannelStore) SaveMultipleMembers(members []*model.ChannelMember) ([]*model.ChannelMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.SaveMultipleMembers(members) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2015,11 +2031,11 @@ func (s *TimerLayerChannelStore) SaveMultipleMembers(members []*model.ChannelMem } func (s *TimerLayerChannelStore) SearchAllChannels(term string, opts store.ChannelSearchOpts) (model.ChannelListWithTeamData, int64, error) { - start := timemodule.Now() + start := time.Now() result, resultVar1, err := s.ChannelStore.SearchAllChannels(term, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2031,11 +2047,11 @@ func (s *TimerLayerChannelStore) SearchAllChannels(term string, opts store.Chann } func (s *TimerLayerChannelStore) SearchArchivedInTeam(teamID string, term string, userID string) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.SearchArchivedInTeam(teamID, term, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2047,11 +2063,11 @@ func (s *TimerLayerChannelStore) SearchArchivedInTeam(teamID string, term string } func (s *TimerLayerChannelStore) SearchForUserInTeam(userID string, teamID string, term string, includeDeleted bool) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.SearchForUserInTeam(userID, teamID, term, includeDeleted) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2063,11 +2079,11 @@ func (s *TimerLayerChannelStore) SearchForUserInTeam(userID string, teamID strin } func (s *TimerLayerChannelStore) SearchGroupChannels(userID string, term string) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.SearchGroupChannels(userID, term) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2079,11 +2095,11 @@ func (s *TimerLayerChannelStore) SearchGroupChannels(userID string, term string) } func (s *TimerLayerChannelStore) SearchInTeam(teamID string, term string, includeDeleted bool) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.SearchInTeam(teamID, term, includeDeleted) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2095,11 +2111,11 @@ func (s *TimerLayerChannelStore) SearchInTeam(teamID string, term string, includ } func (s *TimerLayerChannelStore) SearchMore(userID string, teamID string, term string) (model.ChannelList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.SearchMore(userID, teamID, term) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2111,11 +2127,11 @@ func (s *TimerLayerChannelStore) SearchMore(userID string, teamID string, term s } func (s *TimerLayerChannelStore) SetDeleteAt(channelID string, deleteAt int64, updateAt int64) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.SetDeleteAt(channelID, deleteAt, updateAt) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2127,11 +2143,11 @@ func (s *TimerLayerChannelStore) SetDeleteAt(channelID string, deleteAt int64, u } func (s *TimerLayerChannelStore) SetShared(channelId string, shared bool) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.SetShared(channelId, shared) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2143,11 +2159,11 @@ func (s *TimerLayerChannelStore) SetShared(channelId string, shared bool) error } func (s *TimerLayerChannelStore) Update(channel *model.Channel) (*model.Channel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.Update(channel) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2159,11 +2175,11 @@ func (s *TimerLayerChannelStore) Update(channel *model.Channel) (*model.Channel, } func (s *TimerLayerChannelStore) UpdateLastViewedAt(channelIds []string, userID string) (map[string]int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.UpdateLastViewedAt(channelIds, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2175,11 +2191,11 @@ func (s *TimerLayerChannelStore) UpdateLastViewedAt(channelIds []string, userID } func (s *TimerLayerChannelStore) UpdateLastViewedAtPost(unreadPost *model.Post, userID string, mentionCount int, mentionCountRoot int, setUnreadCountRoot bool) (*model.ChannelUnreadAt, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.UpdateLastViewedAtPost(unreadPost, userID, mentionCount, mentionCountRoot, setUnreadCountRoot) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2191,11 +2207,11 @@ func (s *TimerLayerChannelStore) UpdateLastViewedAtPost(unreadPost *model.Post, } func (s *TimerLayerChannelStore) UpdateMember(member *model.ChannelMember) (*model.ChannelMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.UpdateMember(member) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2207,11 +2223,11 @@ func (s *TimerLayerChannelStore) UpdateMember(member *model.ChannelMember) (*mod } func (s *TimerLayerChannelStore) UpdateMemberNotifyProps(channelID string, userID string, props map[string]string) (*model.ChannelMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.UpdateMemberNotifyProps(channelID, userID, props) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2223,11 +2239,11 @@ func (s *TimerLayerChannelStore) UpdateMemberNotifyProps(channelID string, userI } func (s *TimerLayerChannelStore) UpdateMembersRole(channelID string, userIDs []string) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.UpdateMembersRole(channelID, userIDs) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2239,11 +2255,11 @@ func (s *TimerLayerChannelStore) UpdateMembersRole(channelID string, userIDs []s } func (s *TimerLayerChannelStore) UpdateMultipleMembers(members []*model.ChannelMember) ([]*model.ChannelMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.UpdateMultipleMembers(members) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2255,11 +2271,11 @@ func (s *TimerLayerChannelStore) UpdateMultipleMembers(members []*model.ChannelM } func (s *TimerLayerChannelStore) UpdateSidebarCategories(userID string, teamID string, categories []*model.SidebarCategoryWithChannels) ([]*model.SidebarCategoryWithChannels, []*model.SidebarCategoryWithChannels, error) { - start := timemodule.Now() + start := time.Now() result, resultVar1, err := s.ChannelStore.UpdateSidebarCategories(userID, teamID, categories) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2271,11 +2287,11 @@ func (s *TimerLayerChannelStore) UpdateSidebarCategories(userID string, teamID s } func (s *TimerLayerChannelStore) UpdateSidebarCategoryOrder(userID string, teamID string, categoryOrder []string) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.UpdateSidebarCategoryOrder(userID, teamID, categoryOrder) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2287,11 +2303,11 @@ func (s *TimerLayerChannelStore) UpdateSidebarCategoryOrder(userID string, teamI } func (s *TimerLayerChannelStore) UpdateSidebarChannelCategoryOnMove(channel *model.Channel, newTeamID string) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.UpdateSidebarChannelCategoryOnMove(channel, newTeamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2303,11 +2319,11 @@ func (s *TimerLayerChannelStore) UpdateSidebarChannelCategoryOnMove(channel *mod } func (s *TimerLayerChannelStore) UpdateSidebarChannelsByPreferences(preferences model.Preferences) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelStore.UpdateSidebarChannelsByPreferences(preferences) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2319,11 +2335,11 @@ func (s *TimerLayerChannelStore) UpdateSidebarChannelsByPreferences(preferences } func (s *TimerLayerChannelStore) UserBelongsToChannels(userID string, channelIds []string) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelStore.UserBelongsToChannels(userID, channelIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2335,11 +2351,11 @@ func (s *TimerLayerChannelStore) UserBelongsToChannels(userID string, channelIds } func (s *TimerLayerChannelMemberHistoryStore) DeleteOrphanedRows(limit int) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelMemberHistoryStore.DeleteOrphanedRows(limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2351,11 +2367,11 @@ func (s *TimerLayerChannelMemberHistoryStore) DeleteOrphanedRows(limit int) (int } func (s *TimerLayerChannelMemberHistoryStore) GetChannelsLeftSince(userID string, since int64) ([]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelMemberHistoryStore.GetChannelsLeftSince(userID, since) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2367,11 +2383,11 @@ func (s *TimerLayerChannelMemberHistoryStore) GetChannelsLeftSince(userID string } func (s *TimerLayerChannelMemberHistoryStore) GetUsersInChannelDuring(startTime int64, endTime int64, channelID string) ([]*model.ChannelMemberHistoryResult, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelMemberHistoryStore.GetUsersInChannelDuring(startTime, endTime, channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2383,11 +2399,11 @@ func (s *TimerLayerChannelMemberHistoryStore) GetUsersInChannelDuring(startTime } func (s *TimerLayerChannelMemberHistoryStore) LogJoinEvent(userID string, channelID string, joinTime int64) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelMemberHistoryStore.LogJoinEvent(userID, channelID, joinTime) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2399,11 +2415,11 @@ func (s *TimerLayerChannelMemberHistoryStore) LogJoinEvent(userID string, channe } func (s *TimerLayerChannelMemberHistoryStore) LogLeaveEvent(userID string, channelID string, leaveTime int64) error { - start := timemodule.Now() + start := time.Now() err := s.ChannelMemberHistoryStore.LogLeaveEvent(userID, channelID, leaveTime) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2415,11 +2431,11 @@ func (s *TimerLayerChannelMemberHistoryStore) LogLeaveEvent(userID string, chann } func (s *TimerLayerChannelMemberHistoryStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ChannelMemberHistoryStore.PermanentDeleteBatch(endTime, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2431,11 +2447,11 @@ func (s *TimerLayerChannelMemberHistoryStore) PermanentDeleteBatch(endTime int64 } func (s *TimerLayerChannelMemberHistoryStore) PermanentDeleteBatchForRetentionPolicies(now int64, globalPolicyEndTime int64, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) { - start := timemodule.Now() + start := time.Now() result, resultVar1, err := s.ChannelMemberHistoryStore.PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit, cursor) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2447,11 +2463,11 @@ func (s *TimerLayerChannelMemberHistoryStore) PermanentDeleteBatchForRetentionPo } func (s *TimerLayerClusterDiscoveryStore) Cleanup() error { - start := timemodule.Now() + start := time.Now() err := s.ClusterDiscoveryStore.Cleanup() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2463,11 +2479,11 @@ func (s *TimerLayerClusterDiscoveryStore) Cleanup() error { } func (s *TimerLayerClusterDiscoveryStore) Delete(discovery *model.ClusterDiscovery) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ClusterDiscoveryStore.Delete(discovery) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2479,11 +2495,11 @@ func (s *TimerLayerClusterDiscoveryStore) Delete(discovery *model.ClusterDiscove } func (s *TimerLayerClusterDiscoveryStore) Exists(discovery *model.ClusterDiscovery) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ClusterDiscoveryStore.Exists(discovery) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2495,11 +2511,11 @@ func (s *TimerLayerClusterDiscoveryStore) Exists(discovery *model.ClusterDiscove } func (s *TimerLayerClusterDiscoveryStore) GetAll(discoveryType string, clusterName string) ([]*model.ClusterDiscovery, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ClusterDiscoveryStore.GetAll(discoveryType, clusterName) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2511,11 +2527,11 @@ func (s *TimerLayerClusterDiscoveryStore) GetAll(discoveryType string, clusterNa } func (s *TimerLayerClusterDiscoveryStore) Save(discovery *model.ClusterDiscovery) error { - start := timemodule.Now() + start := time.Now() err := s.ClusterDiscoveryStore.Save(discovery) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2527,11 +2543,11 @@ func (s *TimerLayerClusterDiscoveryStore) Save(discovery *model.ClusterDiscovery } func (s *TimerLayerClusterDiscoveryStore) SetLastPingAt(discovery *model.ClusterDiscovery) error { - start := timemodule.Now() + start := time.Now() err := s.ClusterDiscoveryStore.SetLastPingAt(discovery) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2543,11 +2559,11 @@ func (s *TimerLayerClusterDiscoveryStore) SetLastPingAt(discovery *model.Cluster } func (s *TimerLayerCommandStore) AnalyticsCommandCount(teamID string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.CommandStore.AnalyticsCommandCount(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2558,12 +2574,12 @@ func (s *TimerLayerCommandStore) AnalyticsCommandCount(teamID string) (int64, er return result, err } -func (s *TimerLayerCommandStore) Delete(commandID string, time int64) error { - start := timemodule.Now() +func (s *TimerLayerCommandStore) Delete(commandID string, timestamp int64) error { + start := time.Now() - err := s.CommandStore.Delete(commandID, time) + err := s.CommandStore.Delete(commandID, timestamp) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2575,11 +2591,11 @@ func (s *TimerLayerCommandStore) Delete(commandID string, time int64) error { } func (s *TimerLayerCommandStore) Get(id string) (*model.Command, error) { - start := timemodule.Now() + start := time.Now() result, err := s.CommandStore.Get(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2591,11 +2607,11 @@ func (s *TimerLayerCommandStore) Get(id string) (*model.Command, error) { } func (s *TimerLayerCommandStore) GetByTeam(teamID string) ([]*model.Command, error) { - start := timemodule.Now() + start := time.Now() result, err := s.CommandStore.GetByTeam(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2607,11 +2623,11 @@ func (s *TimerLayerCommandStore) GetByTeam(teamID string) ([]*model.Command, err } func (s *TimerLayerCommandStore) GetByTrigger(teamID string, trigger string) (*model.Command, error) { - start := timemodule.Now() + start := time.Now() result, err := s.CommandStore.GetByTrigger(teamID, trigger) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2623,11 +2639,11 @@ func (s *TimerLayerCommandStore) GetByTrigger(teamID string, trigger string) (*m } func (s *TimerLayerCommandStore) PermanentDeleteByTeam(teamID string) error { - start := timemodule.Now() + start := time.Now() err := s.CommandStore.PermanentDeleteByTeam(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2639,11 +2655,11 @@ func (s *TimerLayerCommandStore) PermanentDeleteByTeam(teamID string) error { } func (s *TimerLayerCommandStore) PermanentDeleteByUser(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.CommandStore.PermanentDeleteByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2655,11 +2671,11 @@ func (s *TimerLayerCommandStore) PermanentDeleteByUser(userID string) error { } func (s *TimerLayerCommandStore) Save(webhook *model.Command) (*model.Command, error) { - start := timemodule.Now() + start := time.Now() result, err := s.CommandStore.Save(webhook) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2671,11 +2687,11 @@ func (s *TimerLayerCommandStore) Save(webhook *model.Command) (*model.Command, e } func (s *TimerLayerCommandStore) Update(hook *model.Command) (*model.Command, error) { - start := timemodule.Now() + start := time.Now() result, err := s.CommandStore.Update(hook) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2687,11 +2703,11 @@ func (s *TimerLayerCommandStore) Update(hook *model.Command) (*model.Command, er } func (s *TimerLayerCommandWebhookStore) Cleanup() { - start := timemodule.Now() + start := time.Now() s.CommandWebhookStore.Cleanup() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -2702,11 +2718,11 @@ func (s *TimerLayerCommandWebhookStore) Cleanup() { } func (s *TimerLayerCommandWebhookStore) Get(id string) (*model.CommandWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.CommandWebhookStore.Get(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2718,11 +2734,11 @@ func (s *TimerLayerCommandWebhookStore) Get(id string) (*model.CommandWebhook, e } func (s *TimerLayerCommandWebhookStore) Save(webhook *model.CommandWebhook) (*model.CommandWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.CommandWebhookStore.Save(webhook) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2734,11 +2750,11 @@ func (s *TimerLayerCommandWebhookStore) Save(webhook *model.CommandWebhook) (*mo } func (s *TimerLayerCommandWebhookStore) TryUse(id string, limit int) error { - start := timemodule.Now() + start := time.Now() err := s.CommandWebhookStore.TryUse(id, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2750,11 +2766,11 @@ func (s *TimerLayerCommandWebhookStore) TryUse(id string, limit int) error { } func (s *TimerLayerComplianceStore) ComplianceExport(compliance *model.Compliance, cursor model.ComplianceExportCursor, limit int) ([]*model.CompliancePost, model.ComplianceExportCursor, error) { - start := timemodule.Now() + start := time.Now() result, resultVar1, err := s.ComplianceStore.ComplianceExport(compliance, cursor, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2766,11 +2782,11 @@ func (s *TimerLayerComplianceStore) ComplianceExport(compliance *model.Complianc } func (s *TimerLayerComplianceStore) Get(id string) (*model.Compliance, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ComplianceStore.Get(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2782,11 +2798,11 @@ func (s *TimerLayerComplianceStore) Get(id string) (*model.Compliance, error) { } func (s *TimerLayerComplianceStore) GetAll(offset int, limit int) (model.Compliances, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ComplianceStore.GetAll(offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2798,11 +2814,11 @@ func (s *TimerLayerComplianceStore) GetAll(offset int, limit int) (model.Complia } func (s *TimerLayerComplianceStore) MessageExport(cursor model.MessageExportCursor, limit int) ([]*model.MessageExport, model.MessageExportCursor, error) { - start := timemodule.Now() + start := time.Now() result, resultVar1, err := s.ComplianceStore.MessageExport(cursor, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2814,11 +2830,11 @@ func (s *TimerLayerComplianceStore) MessageExport(cursor model.MessageExportCurs } func (s *TimerLayerComplianceStore) Save(compliance *model.Compliance) (*model.Compliance, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ComplianceStore.Save(compliance) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2830,11 +2846,11 @@ func (s *TimerLayerComplianceStore) Save(compliance *model.Compliance) (*model.C } func (s *TimerLayerComplianceStore) Update(compliance *model.Compliance) (*model.Compliance, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ComplianceStore.Update(compliance) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2845,12 +2861,12 @@ func (s *TimerLayerComplianceStore) Update(compliance *model.Compliance) (*model return result, err } -func (s *TimerLayerEmojiStore) Delete(emoji *model.Emoji, time int64) error { - start := timemodule.Now() +func (s *TimerLayerEmojiStore) Delete(emoji *model.Emoji, timestamp int64) error { + start := time.Now() - err := s.EmojiStore.Delete(emoji, time) + err := s.EmojiStore.Delete(emoji, timestamp) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2862,11 +2878,11 @@ func (s *TimerLayerEmojiStore) Delete(emoji *model.Emoji, time int64) error { } func (s *TimerLayerEmojiStore) Get(ctx context.Context, id string, allowFromCache bool) (*model.Emoji, error) { - start := timemodule.Now() + start := time.Now() result, err := s.EmojiStore.Get(ctx, id, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2878,11 +2894,11 @@ func (s *TimerLayerEmojiStore) Get(ctx context.Context, id string, allowFromCach } func (s *TimerLayerEmojiStore) GetByName(ctx context.Context, name string, allowFromCache bool) (*model.Emoji, error) { - start := timemodule.Now() + start := time.Now() result, err := s.EmojiStore.GetByName(ctx, name, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2894,11 +2910,11 @@ func (s *TimerLayerEmojiStore) GetByName(ctx context.Context, name string, allow } func (s *TimerLayerEmojiStore) GetList(offset int, limit int, sort string) ([]*model.Emoji, error) { - start := timemodule.Now() + start := time.Now() result, err := s.EmojiStore.GetList(offset, limit, sort) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2910,11 +2926,11 @@ func (s *TimerLayerEmojiStore) GetList(offset int, limit int, sort string) ([]*m } func (s *TimerLayerEmojiStore) GetMultipleByName(names []string) ([]*model.Emoji, error) { - start := timemodule.Now() + start := time.Now() result, err := s.EmojiStore.GetMultipleByName(names) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2926,11 +2942,11 @@ func (s *TimerLayerEmojiStore) GetMultipleByName(names []string) ([]*model.Emoji } func (s *TimerLayerEmojiStore) Save(emoji *model.Emoji) (*model.Emoji, error) { - start := timemodule.Now() + start := time.Now() result, err := s.EmojiStore.Save(emoji) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2942,11 +2958,11 @@ func (s *TimerLayerEmojiStore) Save(emoji *model.Emoji) (*model.Emoji, error) { } func (s *TimerLayerEmojiStore) Search(name string, prefixOnly bool, limit int) ([]*model.Emoji, error) { - start := timemodule.Now() + start := time.Now() result, err := s.EmojiStore.Search(name, prefixOnly, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2958,11 +2974,11 @@ func (s *TimerLayerEmojiStore) Search(name string, prefixOnly bool, limit int) ( } func (s *TimerLayerFileInfoStore) AttachToPost(fileID string, postID string, creatorID string) error { - start := timemodule.Now() + start := time.Now() err := s.FileInfoStore.AttachToPost(fileID, postID, creatorID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -2974,11 +2990,11 @@ func (s *TimerLayerFileInfoStore) AttachToPost(fileID string, postID string, cre } func (s *TimerLayerFileInfoStore) ClearCaches() { - start := timemodule.Now() + start := time.Now() s.FileInfoStore.ClearCaches() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -2989,11 +3005,11 @@ func (s *TimerLayerFileInfoStore) ClearCaches() { } func (s *TimerLayerFileInfoStore) CountAll() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.CountAll() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3005,11 +3021,11 @@ func (s *TimerLayerFileInfoStore) CountAll() (int64, error) { } func (s *TimerLayerFileInfoStore) DeleteForPost(postID string) (string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.DeleteForPost(postID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3021,11 +3037,11 @@ func (s *TimerLayerFileInfoStore) DeleteForPost(postID string) (string, error) { } func (s *TimerLayerFileInfoStore) Get(id string) (*model.FileInfo, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.Get(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3037,11 +3053,11 @@ func (s *TimerLayerFileInfoStore) Get(id string) (*model.FileInfo, error) { } func (s *TimerLayerFileInfoStore) GetByIds(ids []string) ([]*model.FileInfo, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.GetByIds(ids) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3053,11 +3069,11 @@ func (s *TimerLayerFileInfoStore) GetByIds(ids []string) ([]*model.FileInfo, err } func (s *TimerLayerFileInfoStore) GetByPath(path string) (*model.FileInfo, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.GetByPath(path) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3069,11 +3085,11 @@ func (s *TimerLayerFileInfoStore) GetByPath(path string) (*model.FileInfo, error } func (s *TimerLayerFileInfoStore) GetFilesBatchForIndexing(startTime int64, startFileID string, limit int) ([]*model.FileForIndexing, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.GetFilesBatchForIndexing(startTime, startFileID, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3085,11 +3101,11 @@ func (s *TimerLayerFileInfoStore) GetFilesBatchForIndexing(startTime int64, star } func (s *TimerLayerFileInfoStore) GetForPost(postID string, readFromMaster bool, includeDeleted bool, allowFromCache bool) ([]*model.FileInfo, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.GetForPost(postID, readFromMaster, includeDeleted, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3101,11 +3117,11 @@ func (s *TimerLayerFileInfoStore) GetForPost(postID string, readFromMaster bool, } func (s *TimerLayerFileInfoStore) GetForUser(userID string) ([]*model.FileInfo, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.GetForUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3117,11 +3133,11 @@ func (s *TimerLayerFileInfoStore) GetForUser(userID string) ([]*model.FileInfo, } func (s *TimerLayerFileInfoStore) GetFromMaster(id string) (*model.FileInfo, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.GetFromMaster(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3133,11 +3149,11 @@ func (s *TimerLayerFileInfoStore) GetFromMaster(id string) (*model.FileInfo, err } func (s *TimerLayerFileInfoStore) GetStorageUsage(allowFromCache bool, includeDeleted bool) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.GetStorageUsage(allowFromCache, includeDeleted) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3149,11 +3165,11 @@ func (s *TimerLayerFileInfoStore) GetStorageUsage(allowFromCache bool, includeDe } func (s *TimerLayerFileInfoStore) GetWithOptions(page int, perPage int, opt *model.GetFileInfosOptions) ([]*model.FileInfo, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.GetWithOptions(page, perPage, opt) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3165,11 +3181,11 @@ func (s *TimerLayerFileInfoStore) GetWithOptions(page int, perPage int, opt *mod } func (s *TimerLayerFileInfoStore) InvalidateFileInfosForPostCache(postID string, deleted bool) { - start := timemodule.Now() + start := time.Now() s.FileInfoStore.InvalidateFileInfosForPostCache(postID, deleted) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -3180,11 +3196,11 @@ func (s *TimerLayerFileInfoStore) InvalidateFileInfosForPostCache(postID string, } func (s *TimerLayerFileInfoStore) PermanentDelete(fileID string) error { - start := timemodule.Now() + start := time.Now() err := s.FileInfoStore.PermanentDelete(fileID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3196,11 +3212,11 @@ func (s *TimerLayerFileInfoStore) PermanentDelete(fileID string) error { } func (s *TimerLayerFileInfoStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.PermanentDeleteBatch(endTime, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3212,11 +3228,11 @@ func (s *TimerLayerFileInfoStore) PermanentDeleteBatch(endTime int64, limit int6 } func (s *TimerLayerFileInfoStore) PermanentDeleteByUser(userID string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.PermanentDeleteByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3228,11 +3244,11 @@ func (s *TimerLayerFileInfoStore) PermanentDeleteByUser(userID string) (int64, e } func (s *TimerLayerFileInfoStore) Save(info *model.FileInfo) (*model.FileInfo, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.Save(info) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3244,11 +3260,11 @@ func (s *TimerLayerFileInfoStore) Save(info *model.FileInfo) (*model.FileInfo, e } func (s *TimerLayerFileInfoStore) Search(paramsList []*model.SearchParams, userID string, teamID string, page int, perPage int) (*model.FileInfoList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.Search(paramsList, userID, teamID, page, perPage) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3260,11 +3276,11 @@ func (s *TimerLayerFileInfoStore) Search(paramsList []*model.SearchParams, userI } func (s *TimerLayerFileInfoStore) SetContent(fileID string, content string) error { - start := timemodule.Now() + start := time.Now() err := s.FileInfoStore.SetContent(fileID, content) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3276,11 +3292,11 @@ func (s *TimerLayerFileInfoStore) SetContent(fileID string, content string) erro } func (s *TimerLayerFileInfoStore) Upsert(info *model.FileInfo) (*model.FileInfo, error) { - start := timemodule.Now() + start := time.Now() result, err := s.FileInfoStore.Upsert(info) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3292,11 +3308,11 @@ func (s *TimerLayerFileInfoStore) Upsert(info *model.FileInfo) (*model.FileInfo, } func (s *TimerLayerGroupStore) AdminRoleGroupsForSyncableMember(userID string, syncableID string, syncableType model.GroupSyncableType) ([]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.AdminRoleGroupsForSyncableMember(userID, syncableID, syncableType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3308,11 +3324,11 @@ func (s *TimerLayerGroupStore) AdminRoleGroupsForSyncableMember(userID string, s } func (s *TimerLayerGroupStore) ChannelMembersMinusGroupMembers(channelID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.ChannelMembersMinusGroupMembers(channelID, groupIDs, page, perPage) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3324,11 +3340,11 @@ func (s *TimerLayerGroupStore) ChannelMembersMinusGroupMembers(channelID string, } func (s *TimerLayerGroupStore) ChannelMembersToAdd(since int64, channelID *string, includeRemovedMembers bool) ([]*model.UserChannelIDPair, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.ChannelMembersToAdd(since, channelID, includeRemovedMembers) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3340,11 +3356,11 @@ func (s *TimerLayerGroupStore) ChannelMembersToAdd(since int64, channelID *strin } func (s *TimerLayerGroupStore) ChannelMembersToRemove(channelID *string) ([]*model.ChannelMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.ChannelMembersToRemove(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3356,11 +3372,11 @@ func (s *TimerLayerGroupStore) ChannelMembersToRemove(channelID *string) ([]*mod } func (s *TimerLayerGroupStore) CountChannelMembersMinusGroupMembers(channelID string, groupIDs []string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.CountChannelMembersMinusGroupMembers(channelID, groupIDs) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3372,11 +3388,11 @@ func (s *TimerLayerGroupStore) CountChannelMembersMinusGroupMembers(channelID st } func (s *TimerLayerGroupStore) CountGroupsByChannel(channelID string, opts model.GroupSearchOpts) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.CountGroupsByChannel(channelID, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3388,11 +3404,11 @@ func (s *TimerLayerGroupStore) CountGroupsByChannel(channelID string, opts model } func (s *TimerLayerGroupStore) CountGroupsByTeam(teamID string, opts model.GroupSearchOpts) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.CountGroupsByTeam(teamID, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3404,11 +3420,11 @@ func (s *TimerLayerGroupStore) CountGroupsByTeam(teamID string, opts model.Group } func (s *TimerLayerGroupStore) CountTeamMembersMinusGroupMembers(teamID string, groupIDs []string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.CountTeamMembersMinusGroupMembers(teamID, groupIDs) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3420,11 +3436,11 @@ func (s *TimerLayerGroupStore) CountTeamMembersMinusGroupMembers(teamID string, } func (s *TimerLayerGroupStore) Create(group *model.Group) (*model.Group, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.Create(group) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3436,11 +3452,11 @@ func (s *TimerLayerGroupStore) Create(group *model.Group) (*model.Group, error) } func (s *TimerLayerGroupStore) CreateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.CreateGroupSyncable(groupSyncable) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3452,11 +3468,11 @@ func (s *TimerLayerGroupStore) CreateGroupSyncable(groupSyncable *model.GroupSyn } func (s *TimerLayerGroupStore) CreateWithUserIds(group *model.GroupWithUserIds) (*model.Group, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.CreateWithUserIds(group) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3468,11 +3484,11 @@ func (s *TimerLayerGroupStore) CreateWithUserIds(group *model.GroupWithUserIds) } func (s *TimerLayerGroupStore) Delete(groupID string) (*model.Group, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.Delete(groupID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3484,11 +3500,11 @@ func (s *TimerLayerGroupStore) Delete(groupID string) (*model.Group, error) { } func (s *TimerLayerGroupStore) DeleteGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.DeleteGroupSyncable(groupID, syncableID, syncableType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3500,11 +3516,11 @@ func (s *TimerLayerGroupStore) DeleteGroupSyncable(groupID string, syncableID st } func (s *TimerLayerGroupStore) DeleteMember(groupID string, userID string) (*model.GroupMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.DeleteMember(groupID, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3516,11 +3532,11 @@ func (s *TimerLayerGroupStore) DeleteMember(groupID string, userID string) (*mod } func (s *TimerLayerGroupStore) DeleteMembers(groupID string, userIDs []string) ([]*model.GroupMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.DeleteMembers(groupID, userIDs) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3532,11 +3548,11 @@ func (s *TimerLayerGroupStore) DeleteMembers(groupID string, userIDs []string) ( } func (s *TimerLayerGroupStore) DistinctGroupMemberCount() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.DistinctGroupMemberCount() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3548,11 +3564,11 @@ func (s *TimerLayerGroupStore) DistinctGroupMemberCount() (int64, error) { } func (s *TimerLayerGroupStore) Get(groupID string) (*model.Group, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.Get(groupID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3564,11 +3580,11 @@ func (s *TimerLayerGroupStore) Get(groupID string) (*model.Group, error) { } func (s *TimerLayerGroupStore) GetAllBySource(groupSource model.GroupSource) ([]*model.Group, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetAllBySource(groupSource) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3580,11 +3596,11 @@ func (s *TimerLayerGroupStore) GetAllBySource(groupSource model.GroupSource) ([] } func (s *TimerLayerGroupStore) GetAllGroupSyncablesByGroupId(groupID string, syncableType model.GroupSyncableType) ([]*model.GroupSyncable, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetAllGroupSyncablesByGroupId(groupID, syncableType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3596,11 +3612,11 @@ func (s *TimerLayerGroupStore) GetAllGroupSyncablesByGroupId(groupID string, syn } func (s *TimerLayerGroupStore) GetByIDs(groupIDs []string) ([]*model.Group, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetByIDs(groupIDs) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3612,11 +3628,11 @@ func (s *TimerLayerGroupStore) GetByIDs(groupIDs []string) ([]*model.Group, erro } func (s *TimerLayerGroupStore) GetByName(name string, opts model.GroupSearchOpts) (*model.Group, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetByName(name, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3628,11 +3644,11 @@ func (s *TimerLayerGroupStore) GetByName(name string, opts model.GroupSearchOpts } func (s *TimerLayerGroupStore) GetByRemoteID(remoteID string, groupSource model.GroupSource) (*model.Group, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetByRemoteID(remoteID, groupSource) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3644,11 +3660,11 @@ func (s *TimerLayerGroupStore) GetByRemoteID(remoteID string, groupSource model. } func (s *TimerLayerGroupStore) GetByUser(userID string) ([]*model.Group, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3660,11 +3676,11 @@ func (s *TimerLayerGroupStore) GetByUser(userID string) ([]*model.Group, error) } func (s *TimerLayerGroupStore) GetGroupSyncable(groupID string, syncableID string, syncableType model.GroupSyncableType) (*model.GroupSyncable, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetGroupSyncable(groupID, syncableID, syncableType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3676,11 +3692,11 @@ func (s *TimerLayerGroupStore) GetGroupSyncable(groupID string, syncableID strin } func (s *TimerLayerGroupStore) GetGroups(page int, perPage int, opts model.GroupSearchOpts) ([]*model.Group, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetGroups(page, perPage, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3692,11 +3708,11 @@ func (s *TimerLayerGroupStore) GetGroups(page int, perPage int, opts model.Group } func (s *TimerLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamID string, opts model.GroupSearchOpts) (map[string][]*model.GroupWithSchemeAdmin, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetGroupsAssociatedToChannelsByTeam(teamID, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3708,11 +3724,11 @@ func (s *TimerLayerGroupStore) GetGroupsAssociatedToChannelsByTeam(teamID string } func (s *TimerLayerGroupStore) GetGroupsByChannel(channelID string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetGroupsByChannel(channelID, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3724,11 +3740,11 @@ func (s *TimerLayerGroupStore) GetGroupsByChannel(channelID string, opts model.G } func (s *TimerLayerGroupStore) GetGroupsByTeam(teamID string, opts model.GroupSearchOpts) ([]*model.GroupWithSchemeAdmin, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetGroupsByTeam(teamID, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3740,11 +3756,11 @@ func (s *TimerLayerGroupStore) GetGroupsByTeam(teamID string, opts model.GroupSe } func (s *TimerLayerGroupStore) GetMember(groupID string, userID string) (*model.GroupMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetMember(groupID, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3756,11 +3772,11 @@ func (s *TimerLayerGroupStore) GetMember(groupID string, userID string) (*model. } func (s *TimerLayerGroupStore) GetMemberCount(groupID string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetMemberCount(groupID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3772,11 +3788,11 @@ func (s *TimerLayerGroupStore) GetMemberCount(groupID string) (int64, error) { } func (s *TimerLayerGroupStore) GetMemberUsers(groupID string) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetMemberUsers(groupID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3788,11 +3804,11 @@ func (s *TimerLayerGroupStore) GetMemberUsers(groupID string) ([]*model.User, er } func (s *TimerLayerGroupStore) GetMemberUsersInTeam(groupID string, teamID string) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetMemberUsersInTeam(groupID, teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3804,11 +3820,11 @@ func (s *TimerLayerGroupStore) GetMemberUsersInTeam(groupID string, teamID strin } func (s *TimerLayerGroupStore) GetMemberUsersNotInChannel(groupID string, channelID string) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetMemberUsersNotInChannel(groupID, channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3820,11 +3836,11 @@ func (s *TimerLayerGroupStore) GetMemberUsersNotInChannel(groupID string, channe } func (s *TimerLayerGroupStore) GetMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetMemberUsersPage(groupID, page, perPage) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3836,11 +3852,11 @@ func (s *TimerLayerGroupStore) GetMemberUsersPage(groupID string, page int, perP } func (s *TimerLayerGroupStore) GetNonMemberUsersPage(groupID string, page int, perPage int) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GetNonMemberUsersPage(groupID, page, perPage) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3852,11 +3868,11 @@ func (s *TimerLayerGroupStore) GetNonMemberUsersPage(groupID string, page int, p } func (s *TimerLayerGroupStore) GroupChannelCount() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GroupChannelCount() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3868,11 +3884,11 @@ func (s *TimerLayerGroupStore) GroupChannelCount() (int64, error) { } func (s *TimerLayerGroupStore) GroupCount() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GroupCount() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3884,11 +3900,11 @@ func (s *TimerLayerGroupStore) GroupCount() (int64, error) { } func (s *TimerLayerGroupStore) GroupCountBySource(source model.GroupSource) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GroupCountBySource(source) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3900,11 +3916,11 @@ func (s *TimerLayerGroupStore) GroupCountBySource(source model.GroupSource) (int } func (s *TimerLayerGroupStore) GroupCountWithAllowReference() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GroupCountWithAllowReference() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3916,11 +3932,11 @@ func (s *TimerLayerGroupStore) GroupCountWithAllowReference() (int64, error) { } func (s *TimerLayerGroupStore) GroupMemberCount() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GroupMemberCount() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3932,11 +3948,11 @@ func (s *TimerLayerGroupStore) GroupMemberCount() (int64, error) { } func (s *TimerLayerGroupStore) GroupTeamCount() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.GroupTeamCount() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3948,11 +3964,11 @@ func (s *TimerLayerGroupStore) GroupTeamCount() (int64, error) { } func (s *TimerLayerGroupStore) PermanentDeleteMembersByUser(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.GroupStore.PermanentDeleteMembersByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3964,11 +3980,11 @@ func (s *TimerLayerGroupStore) PermanentDeleteMembersByUser(userID string) error } func (s *TimerLayerGroupStore) PermittedSyncableAdmins(syncableID string, syncableType model.GroupSyncableType) ([]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.PermittedSyncableAdmins(syncableID, syncableType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3980,11 +3996,11 @@ func (s *TimerLayerGroupStore) PermittedSyncableAdmins(syncableID string, syncab } func (s *TimerLayerGroupStore) TeamMembersMinusGroupMembers(teamID string, groupIDs []string, page int, perPage int) ([]*model.UserWithGroups, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.TeamMembersMinusGroupMembers(teamID, groupIDs, page, perPage) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -3996,11 +4012,11 @@ func (s *TimerLayerGroupStore) TeamMembersMinusGroupMembers(teamID string, group } func (s *TimerLayerGroupStore) TeamMembersToAdd(since int64, teamID *string, includeRemovedMembers bool) ([]*model.UserTeamIDPair, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.TeamMembersToAdd(since, teamID, includeRemovedMembers) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4012,11 +4028,11 @@ func (s *TimerLayerGroupStore) TeamMembersToAdd(since int64, teamID *string, inc } func (s *TimerLayerGroupStore) TeamMembersToRemove(teamID *string) ([]*model.TeamMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.TeamMembersToRemove(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4028,11 +4044,11 @@ func (s *TimerLayerGroupStore) TeamMembersToRemove(teamID *string) ([]*model.Tea } func (s *TimerLayerGroupStore) Update(group *model.Group) (*model.Group, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.Update(group) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4044,11 +4060,11 @@ func (s *TimerLayerGroupStore) Update(group *model.Group) (*model.Group, error) } func (s *TimerLayerGroupStore) UpdateGroupSyncable(groupSyncable *model.GroupSyncable) (*model.GroupSyncable, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.UpdateGroupSyncable(groupSyncable) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4060,11 +4076,11 @@ func (s *TimerLayerGroupStore) UpdateGroupSyncable(groupSyncable *model.GroupSyn } func (s *TimerLayerGroupStore) UpsertMember(groupID string, userID string) (*model.GroupMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.UpsertMember(groupID, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4076,11 +4092,11 @@ func (s *TimerLayerGroupStore) UpsertMember(groupID string, userID string) (*mod } func (s *TimerLayerGroupStore) UpsertMembers(groupID string, userIDs []string) ([]*model.GroupMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.GroupStore.UpsertMembers(groupID, userIDs) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4092,11 +4108,11 @@ func (s *TimerLayerGroupStore) UpsertMembers(groupID string, userIDs []string) ( } func (s *TimerLayerJobStore) Cleanup(expiryTime int64, batchSize int) error { - start := timemodule.Now() + start := time.Now() err := s.JobStore.Cleanup(expiryTime, batchSize) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4108,11 +4124,11 @@ func (s *TimerLayerJobStore) Cleanup(expiryTime int64, batchSize int) error { } func (s *TimerLayerJobStore) Delete(id string) (string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.Delete(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4124,11 +4140,11 @@ func (s *TimerLayerJobStore) Delete(id string) (string, error) { } func (s *TimerLayerJobStore) Get(id string) (*model.Job, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.Get(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4140,11 +4156,11 @@ func (s *TimerLayerJobStore) Get(id string) (*model.Job, error) { } func (s *TimerLayerJobStore) GetAllByStatus(status string) ([]*model.Job, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.GetAllByStatus(status) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4156,11 +4172,11 @@ func (s *TimerLayerJobStore) GetAllByStatus(status string) ([]*model.Job, error) } func (s *TimerLayerJobStore) GetAllByType(jobType string) ([]*model.Job, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.GetAllByType(jobType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4172,11 +4188,11 @@ func (s *TimerLayerJobStore) GetAllByType(jobType string) ([]*model.Job, error) } func (s *TimerLayerJobStore) GetAllByTypeAndStatus(jobType string, status string) ([]*model.Job, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.GetAllByTypeAndStatus(jobType, status) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4188,11 +4204,11 @@ func (s *TimerLayerJobStore) GetAllByTypeAndStatus(jobType string, status string } func (s *TimerLayerJobStore) GetAllByTypePage(jobType string, offset int, limit int) ([]*model.Job, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.GetAllByTypePage(jobType, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4204,11 +4220,11 @@ func (s *TimerLayerJobStore) GetAllByTypePage(jobType string, offset int, limit } func (s *TimerLayerJobStore) GetAllByTypesPage(jobTypes []string, offset int, limit int) ([]*model.Job, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.GetAllByTypesPage(jobTypes, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4220,11 +4236,11 @@ func (s *TimerLayerJobStore) GetAllByTypesPage(jobTypes []string, offset int, li } func (s *TimerLayerJobStore) GetAllPage(offset int, limit int) ([]*model.Job, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.GetAllPage(offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4236,11 +4252,11 @@ func (s *TimerLayerJobStore) GetAllPage(offset int, limit int) ([]*model.Job, er } func (s *TimerLayerJobStore) GetCountByStatusAndType(status string, jobType string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.GetCountByStatusAndType(status, jobType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4252,11 +4268,11 @@ func (s *TimerLayerJobStore) GetCountByStatusAndType(status string, jobType stri } func (s *TimerLayerJobStore) GetNewestJobByStatusAndType(status string, jobType string) (*model.Job, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.GetNewestJobByStatusAndType(status, jobType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4268,11 +4284,11 @@ func (s *TimerLayerJobStore) GetNewestJobByStatusAndType(status string, jobType } func (s *TimerLayerJobStore) GetNewestJobByStatusesAndType(statuses []string, jobType string) (*model.Job, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.GetNewestJobByStatusesAndType(statuses, jobType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4284,11 +4300,11 @@ func (s *TimerLayerJobStore) GetNewestJobByStatusesAndType(statuses []string, jo } func (s *TimerLayerJobStore) Save(job *model.Job) (*model.Job, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.Save(job) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4300,11 +4316,11 @@ func (s *TimerLayerJobStore) Save(job *model.Job) (*model.Job, error) { } func (s *TimerLayerJobStore) UpdateOptimistically(job *model.Job, currentStatus string) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.UpdateOptimistically(job, currentStatus) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4316,11 +4332,11 @@ func (s *TimerLayerJobStore) UpdateOptimistically(job *model.Job, currentStatus } func (s *TimerLayerJobStore) UpdateStatus(id string, status string) (*model.Job, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.UpdateStatus(id, status) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4332,11 +4348,11 @@ func (s *TimerLayerJobStore) UpdateStatus(id string, status string) (*model.Job, } func (s *TimerLayerJobStore) UpdateStatusOptimistically(id string, currentStatus string, newStatus string) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.JobStore.UpdateStatusOptimistically(id, currentStatus, newStatus) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4348,11 +4364,11 @@ func (s *TimerLayerJobStore) UpdateStatusOptimistically(id string, currentStatus } func (s *TimerLayerLicenseStore) Get(id string) (*model.LicenseRecord, error) { - start := timemodule.Now() + start := time.Now() result, err := s.LicenseStore.Get(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4364,11 +4380,11 @@ func (s *TimerLayerLicenseStore) Get(id string) (*model.LicenseRecord, error) { } func (s *TimerLayerLicenseStore) GetAll() ([]*model.LicenseRecord, error) { - start := timemodule.Now() + start := time.Now() result, err := s.LicenseStore.GetAll() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4380,11 +4396,11 @@ func (s *TimerLayerLicenseStore) GetAll() ([]*model.LicenseRecord, error) { } func (s *TimerLayerLicenseStore) Save(license *model.LicenseRecord) (*model.LicenseRecord, error) { - start := timemodule.Now() + start := time.Now() result, err := s.LicenseStore.Save(license) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4396,11 +4412,11 @@ func (s *TimerLayerLicenseStore) Save(license *model.LicenseRecord) (*model.Lice } func (s *TimerLayerLinkMetadataStore) Get(url string, timestamp int64) (*model.LinkMetadata, error) { - start := timemodule.Now() + start := time.Now() result, err := s.LinkMetadataStore.Get(url, timestamp) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4412,11 +4428,11 @@ func (s *TimerLayerLinkMetadataStore) Get(url string, timestamp int64) (*model.L } func (s *TimerLayerLinkMetadataStore) Save(linkMetadata *model.LinkMetadata) (*model.LinkMetadata, error) { - start := timemodule.Now() + start := time.Now() result, err := s.LinkMetadataStore.Save(linkMetadata) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4428,11 +4444,11 @@ func (s *TimerLayerLinkMetadataStore) Save(linkMetadata *model.LinkMetadata) (*m } func (s *TimerLayerOAuthStore) DeleteApp(id string) error { - start := timemodule.Now() + start := time.Now() err := s.OAuthStore.DeleteApp(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4444,11 +4460,11 @@ func (s *TimerLayerOAuthStore) DeleteApp(id string) error { } func (s *TimerLayerOAuthStore) GetAccessData(token string) (*model.AccessData, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.GetAccessData(token) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4460,11 +4476,11 @@ func (s *TimerLayerOAuthStore) GetAccessData(token string) (*model.AccessData, e } func (s *TimerLayerOAuthStore) GetAccessDataByRefreshToken(token string) (*model.AccessData, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.GetAccessDataByRefreshToken(token) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4476,11 +4492,11 @@ func (s *TimerLayerOAuthStore) GetAccessDataByRefreshToken(token string) (*model } func (s *TimerLayerOAuthStore) GetAccessDataByUserForApp(userID string, clientId string) ([]*model.AccessData, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.GetAccessDataByUserForApp(userID, clientId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4492,11 +4508,11 @@ func (s *TimerLayerOAuthStore) GetAccessDataByUserForApp(userID string, clientId } func (s *TimerLayerOAuthStore) GetApp(id string) (*model.OAuthApp, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.GetApp(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4508,11 +4524,11 @@ func (s *TimerLayerOAuthStore) GetApp(id string) (*model.OAuthApp, error) { } func (s *TimerLayerOAuthStore) GetAppByUser(userID string, offset int, limit int) ([]*model.OAuthApp, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.GetAppByUser(userID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4524,11 +4540,11 @@ func (s *TimerLayerOAuthStore) GetAppByUser(userID string, offset int, limit int } func (s *TimerLayerOAuthStore) GetApps(offset int, limit int) ([]*model.OAuthApp, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.GetApps(offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4540,11 +4556,11 @@ func (s *TimerLayerOAuthStore) GetApps(offset int, limit int) ([]*model.OAuthApp } func (s *TimerLayerOAuthStore) GetAuthData(code string) (*model.AuthData, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.GetAuthData(code) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4556,11 +4572,11 @@ func (s *TimerLayerOAuthStore) GetAuthData(code string) (*model.AuthData, error) } func (s *TimerLayerOAuthStore) GetAuthorizedApps(userID string, offset int, limit int) ([]*model.OAuthApp, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.GetAuthorizedApps(userID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4572,11 +4588,11 @@ func (s *TimerLayerOAuthStore) GetAuthorizedApps(userID string, offset int, limi } func (s *TimerLayerOAuthStore) GetPreviousAccessData(userID string, clientId string) (*model.AccessData, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.GetPreviousAccessData(userID, clientId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4588,11 +4604,11 @@ func (s *TimerLayerOAuthStore) GetPreviousAccessData(userID string, clientId str } func (s *TimerLayerOAuthStore) PermanentDeleteAuthDataByUser(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.OAuthStore.PermanentDeleteAuthDataByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4604,11 +4620,11 @@ func (s *TimerLayerOAuthStore) PermanentDeleteAuthDataByUser(userID string) erro } func (s *TimerLayerOAuthStore) RemoveAccessData(token string) error { - start := timemodule.Now() + start := time.Now() err := s.OAuthStore.RemoveAccessData(token) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4620,11 +4636,11 @@ func (s *TimerLayerOAuthStore) RemoveAccessData(token string) error { } func (s *TimerLayerOAuthStore) RemoveAllAccessData() error { - start := timemodule.Now() + start := time.Now() err := s.OAuthStore.RemoveAllAccessData() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4636,11 +4652,11 @@ func (s *TimerLayerOAuthStore) RemoveAllAccessData() error { } func (s *TimerLayerOAuthStore) RemoveAuthData(code string) error { - start := timemodule.Now() + start := time.Now() err := s.OAuthStore.RemoveAuthData(code) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4652,11 +4668,11 @@ func (s *TimerLayerOAuthStore) RemoveAuthData(code string) error { } func (s *TimerLayerOAuthStore) SaveAccessData(accessData *model.AccessData) (*model.AccessData, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.SaveAccessData(accessData) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4668,11 +4684,11 @@ func (s *TimerLayerOAuthStore) SaveAccessData(accessData *model.AccessData) (*mo } func (s *TimerLayerOAuthStore) SaveApp(app *model.OAuthApp) (*model.OAuthApp, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.SaveApp(app) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4684,11 +4700,11 @@ func (s *TimerLayerOAuthStore) SaveApp(app *model.OAuthApp) (*model.OAuthApp, er } func (s *TimerLayerOAuthStore) SaveAuthData(authData *model.AuthData) (*model.AuthData, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.SaveAuthData(authData) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4700,11 +4716,11 @@ func (s *TimerLayerOAuthStore) SaveAuthData(authData *model.AuthData) (*model.Au } func (s *TimerLayerOAuthStore) UpdateAccessData(accessData *model.AccessData) (*model.AccessData, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.UpdateAccessData(accessData) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4716,11 +4732,11 @@ func (s *TimerLayerOAuthStore) UpdateAccessData(accessData *model.AccessData) (* } func (s *TimerLayerOAuthStore) UpdateApp(app *model.OAuthApp) (*model.OAuthApp, error) { - start := timemodule.Now() + start := time.Now() result, err := s.OAuthStore.UpdateApp(app) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4732,11 +4748,11 @@ func (s *TimerLayerOAuthStore) UpdateApp(app *model.OAuthApp) (*model.OAuthApp, } func (s *TimerLayerPluginStore) CompareAndDelete(keyVal *model.PluginKeyValue, oldValue []byte) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PluginStore.CompareAndDelete(keyVal, oldValue) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4748,11 +4764,11 @@ func (s *TimerLayerPluginStore) CompareAndDelete(keyVal *model.PluginKeyValue, o } func (s *TimerLayerPluginStore) CompareAndSet(keyVal *model.PluginKeyValue, oldValue []byte) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PluginStore.CompareAndSet(keyVal, oldValue) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4764,11 +4780,11 @@ func (s *TimerLayerPluginStore) CompareAndSet(keyVal *model.PluginKeyValue, oldV } func (s *TimerLayerPluginStore) Delete(pluginID string, key string) error { - start := timemodule.Now() + start := time.Now() err := s.PluginStore.Delete(pluginID, key) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4780,11 +4796,11 @@ func (s *TimerLayerPluginStore) Delete(pluginID string, key string) error { } func (s *TimerLayerPluginStore) DeleteAllExpired() error { - start := timemodule.Now() + start := time.Now() err := s.PluginStore.DeleteAllExpired() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4796,11 +4812,11 @@ func (s *TimerLayerPluginStore) DeleteAllExpired() error { } func (s *TimerLayerPluginStore) DeleteAllForPlugin(PluginID string) error { - start := timemodule.Now() + start := time.Now() err := s.PluginStore.DeleteAllForPlugin(PluginID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4812,11 +4828,11 @@ func (s *TimerLayerPluginStore) DeleteAllForPlugin(PluginID string) error { } func (s *TimerLayerPluginStore) Get(pluginID string, key string) (*model.PluginKeyValue, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PluginStore.Get(pluginID, key) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4828,11 +4844,11 @@ func (s *TimerLayerPluginStore) Get(pluginID string, key string) (*model.PluginK } func (s *TimerLayerPluginStore) List(pluginID string, page int, perPage int) ([]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PluginStore.List(pluginID, page, perPage) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4844,11 +4860,11 @@ func (s *TimerLayerPluginStore) List(pluginID string, page int, perPage int) ([] } func (s *TimerLayerPluginStore) SaveOrUpdate(keyVal *model.PluginKeyValue) (*model.PluginKeyValue, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PluginStore.SaveOrUpdate(keyVal) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4860,11 +4876,11 @@ func (s *TimerLayerPluginStore) SaveOrUpdate(keyVal *model.PluginKeyValue) (*mod } func (s *TimerLayerPluginStore) SetWithOptions(pluginID string, key string, value []byte, options model.PluginKVSetOptions) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PluginStore.SetWithOptions(pluginID, key, value, options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4876,11 +4892,11 @@ func (s *TimerLayerPluginStore) SetWithOptions(pluginID string, key string, valu } func (s *TimerLayerPostStore) AnalyticsPostCount(options *model.PostCountOptions) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.AnalyticsPostCount(options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4892,11 +4908,11 @@ func (s *TimerLayerPostStore) AnalyticsPostCount(options *model.PostCountOptions } func (s *TimerLayerPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsPostCountsOptions) (model.AnalyticsRows, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.AnalyticsPostCountsByDay(options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4908,11 +4924,11 @@ func (s *TimerLayerPostStore) AnalyticsPostCountsByDay(options *model.AnalyticsP } func (s *TimerLayerPostStore) AnalyticsUserCountsWithPostsByDay(teamID string) (model.AnalyticsRows, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.AnalyticsUserCountsWithPostsByDay(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4924,11 +4940,11 @@ func (s *TimerLayerPostStore) AnalyticsUserCountsWithPostsByDay(teamID string) ( } func (s *TimerLayerPostStore) ClearCaches() { - start := timemodule.Now() + start := time.Now() s.PostStore.ClearCaches() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -4938,12 +4954,12 @@ func (s *TimerLayerPostStore) ClearCaches() { } } -func (s *TimerLayerPostStore) Delete(postID string, time int64, deleteByID string) error { - start := timemodule.Now() +func (s *TimerLayerPostStore) Delete(postID string, timestamp int64, deleteByID string) error { + start := time.Now() - err := s.PostStore.Delete(postID, time, deleteByID) + err := s.PostStore.Delete(postID, timestamp, deleteByID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4955,11 +4971,11 @@ func (s *TimerLayerPostStore) Delete(postID string, time int64, deleteByID strin } func (s *TimerLayerPostStore) DeleteOrphanedRows(limit int) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.DeleteOrphanedRows(limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4971,11 +4987,11 @@ func (s *TimerLayerPostStore) DeleteOrphanedRows(limit int) (int64, error) { } func (s *TimerLayerPostStore) Get(ctx context.Context, id string, opts model.GetPostsOptions, userID string, sanitizeOptions map[string]bool) (*model.PostList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.Get(ctx, id, opts, userID, sanitizeOptions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -4987,11 +5003,11 @@ func (s *TimerLayerPostStore) Get(ctx context.Context, id string, opts model.Get } func (s *TimerLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afterID string) ([]*model.DirectPostForExport, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetDirectPostParentsForExportAfter(limit, afterID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5003,11 +5019,11 @@ func (s *TimerLayerPostStore) GetDirectPostParentsForExportAfter(limit int, afte } func (s *TimerLayerPostStore) GetEtag(channelID string, allowFromCache bool, collapsedThreads bool) string { - start := timemodule.Now() + start := time.Now() result := s.PostStore.GetEtag(channelID, allowFromCache, collapsedThreads) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -5019,11 +5035,11 @@ func (s *TimerLayerPostStore) GetEtag(channelID string, allowFromCache bool, col } func (s *TimerLayerPostStore) GetFlaggedPosts(userID string, offset int, limit int) (*model.PostList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetFlaggedPosts(userID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5035,11 +5051,11 @@ func (s *TimerLayerPostStore) GetFlaggedPosts(userID string, offset int, limit i } func (s *TimerLayerPostStore) GetFlaggedPostsForChannel(userID string, channelID string, offset int, limit int) (*model.PostList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetFlaggedPostsForChannel(userID, channelID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5051,11 +5067,11 @@ func (s *TimerLayerPostStore) GetFlaggedPostsForChannel(userID string, channelID } func (s *TimerLayerPostStore) GetFlaggedPostsForTeam(userID string, teamID string, offset int, limit int) (*model.PostList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetFlaggedPostsForTeam(userID, teamID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5067,11 +5083,11 @@ func (s *TimerLayerPostStore) GetFlaggedPostsForTeam(userID string, teamID strin } func (s *TimerLayerPostStore) GetLastPostRowCreateAt() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetLastPostRowCreateAt() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5083,11 +5099,11 @@ func (s *TimerLayerPostStore) GetLastPostRowCreateAt() (int64, error) { } func (s *TimerLayerPostStore) GetMaxPostSize() int { - start := timemodule.Now() + start := time.Now() result := s.PostStore.GetMaxPostSize() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -5099,11 +5115,11 @@ func (s *TimerLayerPostStore) GetMaxPostSize() int { } func (s *TimerLayerPostStore) GetOldest() (*model.Post, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetOldest() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5115,11 +5131,11 @@ func (s *TimerLayerPostStore) GetOldest() (*model.Post, error) { } func (s *TimerLayerPostStore) GetOldestEntityCreationTime() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetOldestEntityCreationTime() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5131,11 +5147,11 @@ func (s *TimerLayerPostStore) GetOldestEntityCreationTime() (int64, error) { } func (s *TimerLayerPostStore) GetParentsForExportAfter(limit int, afterID string) ([]*model.PostForExport, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetParentsForExportAfter(limit, afterID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5146,12 +5162,12 @@ func (s *TimerLayerPostStore) GetParentsForExportAfter(limit int, afterID string return result, err } -func (s *TimerLayerPostStore) GetPostAfterTime(channelID string, time int64, collapsedThreads bool) (*model.Post, error) { - start := timemodule.Now() +func (s *TimerLayerPostStore) GetPostAfterTime(channelID string, timestamp int64, collapsedThreads bool) (*model.Post, error) { + start := time.Now() - result, err := s.PostStore.GetPostAfterTime(channelID, time, collapsedThreads) + result, err := s.PostStore.GetPostAfterTime(channelID, timestamp, collapsedThreads) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5162,12 +5178,12 @@ func (s *TimerLayerPostStore) GetPostAfterTime(channelID string, time int64, col return result, err } -func (s *TimerLayerPostStore) GetPostIdAfterTime(channelID string, time int64, collapsedThreads bool) (string, error) { - start := timemodule.Now() +func (s *TimerLayerPostStore) GetPostIdAfterTime(channelID string, timestamp int64, collapsedThreads bool) (string, error) { + start := time.Now() - result, err := s.PostStore.GetPostIdAfterTime(channelID, time, collapsedThreads) + result, err := s.PostStore.GetPostIdAfterTime(channelID, timestamp, collapsedThreads) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5178,12 +5194,12 @@ func (s *TimerLayerPostStore) GetPostIdAfterTime(channelID string, time int64, c return result, err } -func (s *TimerLayerPostStore) GetPostIdBeforeTime(channelID string, time int64, collapsedThreads bool) (string, error) { - start := timemodule.Now() +func (s *TimerLayerPostStore) GetPostIdBeforeTime(channelID string, timestamp int64, collapsedThreads bool) (string, error) { + start := time.Now() - result, err := s.PostStore.GetPostIdBeforeTime(channelID, time, collapsedThreads) + result, err := s.PostStore.GetPostIdBeforeTime(channelID, timestamp, collapsedThreads) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5195,11 +5211,11 @@ func (s *TimerLayerPostStore) GetPostIdBeforeTime(channelID string, time int64, } func (s *TimerLayerPostStore) GetPosts(options model.GetPostsOptions, allowFromCache bool, sanitizeOptions map[string]bool) (*model.PostList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetPosts(options, allowFromCache, sanitizeOptions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5211,11 +5227,11 @@ func (s *TimerLayerPostStore) GetPosts(options model.GetPostsOptions, allowFromC } func (s *TimerLayerPostStore) GetPostsAfter(options model.GetPostsOptions, sanitizeOptions map[string]bool) (*model.PostList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetPostsAfter(options, sanitizeOptions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5227,11 +5243,11 @@ func (s *TimerLayerPostStore) GetPostsAfter(options model.GetPostsOptions, sanit } func (s *TimerLayerPostStore) GetPostsBatchForIndexing(startTime int64, startPostID string, limit int) ([]*model.PostForIndexing, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetPostsBatchForIndexing(startTime, startPostID, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5243,11 +5259,11 @@ func (s *TimerLayerPostStore) GetPostsBatchForIndexing(startTime int64, startPos } func (s *TimerLayerPostStore) GetPostsBefore(options model.GetPostsOptions, sanitizeOptions map[string]bool) (*model.PostList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetPostsBefore(options, sanitizeOptions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5259,11 +5275,11 @@ func (s *TimerLayerPostStore) GetPostsBefore(options model.GetPostsOptions, sani } func (s *TimerLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetPostsByIds(postIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5274,12 +5290,12 @@ func (s *TimerLayerPostStore) GetPostsByIds(postIds []string) ([]*model.Post, er return result, err } -func (s *TimerLayerPostStore) GetPostsCreatedAt(channelID string, time int64) ([]*model.Post, error) { - start := timemodule.Now() +func (s *TimerLayerPostStore) GetPostsCreatedAt(channelID string, timestamp int64) ([]*model.Post, error) { + start := time.Now() - result, err := s.PostStore.GetPostsCreatedAt(channelID, time) + result, err := s.PostStore.GetPostsCreatedAt(channelID, timestamp) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5291,11 +5307,11 @@ func (s *TimerLayerPostStore) GetPostsCreatedAt(channelID string, time int64) ([ } func (s *TimerLayerPostStore) GetPostsSince(options model.GetPostsSinceOptions, allowFromCache bool, sanitizeOptions map[string]bool) (*model.PostList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetPostsSince(options, allowFromCache, sanitizeOptions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5307,11 +5323,11 @@ func (s *TimerLayerPostStore) GetPostsSince(options model.GetPostsSinceOptions, } func (s *TimerLayerPostStore) GetPostsSinceForSync(options model.GetPostsSinceForSyncOptions, cursor model.GetPostsSinceForSyncCursor, limit int) ([]*model.Post, model.GetPostsSinceForSyncCursor, error) { - start := timemodule.Now() + start := time.Now() result, resultVar1, err := s.PostStore.GetPostsSinceForSync(options, cursor, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5323,11 +5339,11 @@ func (s *TimerLayerPostStore) GetPostsSinceForSync(options model.GetPostsSinceFo } func (s *TimerLayerPostStore) GetRecentSearchesForUser(userID string) ([]*model.SearchParams, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetRecentSearchesForUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5339,11 +5355,11 @@ func (s *TimerLayerPostStore) GetRecentSearchesForUser(userID string) ([]*model. } func (s *TimerLayerPostStore) GetRepliesForExport(parentID string) ([]*model.ReplyForExport, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetRepliesForExport(parentID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5355,11 +5371,11 @@ func (s *TimerLayerPostStore) GetRepliesForExport(parentID string) ([]*model.Rep } func (s *TimerLayerPostStore) GetSingle(id string, inclDeleted bool) (*model.Post, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.GetSingle(id, inclDeleted) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5371,11 +5387,11 @@ func (s *TimerLayerPostStore) GetSingle(id string, inclDeleted bool) (*model.Pos } func (s *TimerLayerPostStore) HasAutoResponsePostByUserSince(options model.GetPostsSinceOptions, userId string) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.HasAutoResponsePostByUserSince(options, userId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5387,11 +5403,11 @@ func (s *TimerLayerPostStore) HasAutoResponsePostByUserSince(options model.GetPo } func (s *TimerLayerPostStore) InvalidateLastPostTimeCache(channelID string) { - start := timemodule.Now() + start := time.Now() s.PostStore.InvalidateLastPostTimeCache(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -5402,11 +5418,11 @@ func (s *TimerLayerPostStore) InvalidateLastPostTimeCache(channelID string) { } func (s *TimerLayerPostStore) LogRecentSearch(userID string, searchQuery []byte, createAt int64) error { - start := timemodule.Now() + start := time.Now() err := s.PostStore.LogRecentSearch(userID, searchQuery, createAt) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5418,11 +5434,11 @@ func (s *TimerLayerPostStore) LogRecentSearch(userID string, searchQuery []byte, } func (s *TimerLayerPostStore) Overwrite(post *model.Post) (*model.Post, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.Overwrite(post) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5434,11 +5450,11 @@ func (s *TimerLayerPostStore) Overwrite(post *model.Post) (*model.Post, error) { } func (s *TimerLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.Post, int, error) { - start := timemodule.Now() + start := time.Now() result, resultVar1, err := s.PostStore.OverwriteMultiple(posts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5450,11 +5466,11 @@ func (s *TimerLayerPostStore) OverwriteMultiple(posts []*model.Post) ([]*model.P } func (s *TimerLayerPostStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.PermanentDeleteBatch(endTime, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5466,11 +5482,11 @@ func (s *TimerLayerPostStore) PermanentDeleteBatch(endTime int64, limit int64) ( } func (s *TimerLayerPostStore) PermanentDeleteBatchForRetentionPolicies(now int64, globalPolicyEndTime int64, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) { - start := timemodule.Now() + start := time.Now() result, resultVar1, err := s.PostStore.PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit, cursor) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5482,11 +5498,11 @@ func (s *TimerLayerPostStore) PermanentDeleteBatchForRetentionPolicies(now int64 } func (s *TimerLayerPostStore) PermanentDeleteByChannel(channelID string) error { - start := timemodule.Now() + start := time.Now() err := s.PostStore.PermanentDeleteByChannel(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5498,11 +5514,11 @@ func (s *TimerLayerPostStore) PermanentDeleteByChannel(channelID string) error { } func (s *TimerLayerPostStore) PermanentDeleteByUser(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.PostStore.PermanentDeleteByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5514,11 +5530,11 @@ func (s *TimerLayerPostStore) PermanentDeleteByUser(userID string) error { } func (s *TimerLayerPostStore) Save(post *model.Post) (*model.Post, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.Save(post) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5530,11 +5546,11 @@ func (s *TimerLayerPostStore) Save(post *model.Post) (*model.Post, error) { } func (s *TimerLayerPostStore) SaveMultiple(posts []*model.Post) ([]*model.Post, int, error) { - start := timemodule.Now() + start := time.Now() result, resultVar1, err := s.PostStore.SaveMultiple(posts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5546,11 +5562,11 @@ func (s *TimerLayerPostStore) SaveMultiple(posts []*model.Post) ([]*model.Post, } func (s *TimerLayerPostStore) Search(teamID string, userID string, params *model.SearchParams) (*model.PostList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.Search(teamID, userID, params) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5562,11 +5578,11 @@ func (s *TimerLayerPostStore) Search(teamID string, userID string, params *model } func (s *TimerLayerPostStore) SearchPostsForUser(paramsList []*model.SearchParams, userID string, teamID string, page int, perPage int) (*model.PostSearchResults, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.SearchPostsForUser(paramsList, userID, teamID, page, perPage) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5578,11 +5594,11 @@ func (s *TimerLayerPostStore) SearchPostsForUser(paramsList []*model.SearchParam } func (s *TimerLayerPostStore) Update(newPost *model.Post, oldPost *model.Post) (*model.Post, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PostStore.Update(newPost, oldPost) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5594,11 +5610,11 @@ func (s *TimerLayerPostStore) Update(newPost *model.Post, oldPost *model.Post) ( } func (s *TimerLayerPreferenceStore) CleanupFlagsBatch(limit int64) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PreferenceStore.CleanupFlagsBatch(limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5610,11 +5626,11 @@ func (s *TimerLayerPreferenceStore) CleanupFlagsBatch(limit int64) (int64, error } func (s *TimerLayerPreferenceStore) Delete(userID string, category string, name string) error { - start := timemodule.Now() + start := time.Now() err := s.PreferenceStore.Delete(userID, category, name) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5626,11 +5642,11 @@ func (s *TimerLayerPreferenceStore) Delete(userID string, category string, name } func (s *TimerLayerPreferenceStore) DeleteCategory(userID string, category string) error { - start := timemodule.Now() + start := time.Now() err := s.PreferenceStore.DeleteCategory(userID, category) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5642,11 +5658,11 @@ func (s *TimerLayerPreferenceStore) DeleteCategory(userID string, category strin } func (s *TimerLayerPreferenceStore) DeleteCategoryAndName(category string, name string) error { - start := timemodule.Now() + start := time.Now() err := s.PreferenceStore.DeleteCategoryAndName(category, name) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5658,11 +5674,11 @@ func (s *TimerLayerPreferenceStore) DeleteCategoryAndName(category string, name } func (s *TimerLayerPreferenceStore) DeleteOrphanedRows(limit int) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PreferenceStore.DeleteOrphanedRows(limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5674,11 +5690,11 @@ func (s *TimerLayerPreferenceStore) DeleteOrphanedRows(limit int) (int64, error) } func (s *TimerLayerPreferenceStore) Get(userID string, category string, name string) (*model.Preference, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PreferenceStore.Get(userID, category, name) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5690,11 +5706,11 @@ func (s *TimerLayerPreferenceStore) Get(userID string, category string, name str } func (s *TimerLayerPreferenceStore) GetAll(userID string) (model.Preferences, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PreferenceStore.GetAll(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5706,11 +5722,11 @@ func (s *TimerLayerPreferenceStore) GetAll(userID string) (model.Preferences, er } func (s *TimerLayerPreferenceStore) GetCategory(userID string, category string) (model.Preferences, error) { - start := timemodule.Now() + start := time.Now() result, err := s.PreferenceStore.GetCategory(userID, category) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5722,11 +5738,11 @@ func (s *TimerLayerPreferenceStore) GetCategory(userID string, category string) } func (s *TimerLayerPreferenceStore) PermanentDeleteByUser(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.PreferenceStore.PermanentDeleteByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5738,11 +5754,11 @@ func (s *TimerLayerPreferenceStore) PermanentDeleteByUser(userID string) error { } func (s *TimerLayerPreferenceStore) Save(preferences model.Preferences) error { - start := timemodule.Now() + start := time.Now() err := s.PreferenceStore.Save(preferences) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5754,11 +5770,11 @@ func (s *TimerLayerPreferenceStore) Save(preferences model.Preferences) error { } func (s *TimerLayerProductNoticesStore) Clear(notices []string) error { - start := timemodule.Now() + start := time.Now() err := s.ProductNoticesStore.Clear(notices) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5770,11 +5786,11 @@ func (s *TimerLayerProductNoticesStore) Clear(notices []string) error { } func (s *TimerLayerProductNoticesStore) ClearOldNotices(currentNotices model.ProductNotices) error { - start := timemodule.Now() + start := time.Now() err := s.ProductNoticesStore.ClearOldNotices(currentNotices) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5786,11 +5802,11 @@ func (s *TimerLayerProductNoticesStore) ClearOldNotices(currentNotices model.Pro } func (s *TimerLayerProductNoticesStore) GetViews(userID string) ([]model.ProductNoticeViewState, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ProductNoticesStore.GetViews(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5802,11 +5818,11 @@ func (s *TimerLayerProductNoticesStore) GetViews(userID string) ([]model.Product } func (s *TimerLayerProductNoticesStore) View(userID string, notices []string) error { - start := timemodule.Now() + start := time.Now() err := s.ProductNoticesStore.View(userID, notices) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5818,11 +5834,11 @@ func (s *TimerLayerProductNoticesStore) View(userID string, notices []string) er } func (s *TimerLayerReactionStore) BulkGetForPosts(postIds []string) ([]*model.Reaction, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ReactionStore.BulkGetForPosts(postIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5834,11 +5850,11 @@ func (s *TimerLayerReactionStore) BulkGetForPosts(postIds []string) ([]*model.Re } func (s *TimerLayerReactionStore) Delete(reaction *model.Reaction) (*model.Reaction, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ReactionStore.Delete(reaction) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5850,11 +5866,11 @@ func (s *TimerLayerReactionStore) Delete(reaction *model.Reaction) (*model.React } func (s *TimerLayerReactionStore) DeleteAllWithEmojiName(emojiName string) error { - start := timemodule.Now() + start := time.Now() err := s.ReactionStore.DeleteAllWithEmojiName(emojiName) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5866,11 +5882,11 @@ func (s *TimerLayerReactionStore) DeleteAllWithEmojiName(emojiName string) error } func (s *TimerLayerReactionStore) DeleteOrphanedRows(limit int) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ReactionStore.DeleteOrphanedRows(limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5882,11 +5898,11 @@ func (s *TimerLayerReactionStore) DeleteOrphanedRows(limit int) (int64, error) { } func (s *TimerLayerReactionStore) GetForPost(postID string, allowFromCache bool) ([]*model.Reaction, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ReactionStore.GetForPost(postID, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5898,11 +5914,11 @@ func (s *TimerLayerReactionStore) GetForPost(postID string, allowFromCache bool) } func (s *TimerLayerReactionStore) GetForPostSince(postId string, since int64, excludeRemoteId string, inclDeleted bool) ([]*model.Reaction, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ReactionStore.GetForPostSince(postId, since, excludeRemoteId, inclDeleted) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5914,11 +5930,11 @@ func (s *TimerLayerReactionStore) GetForPostSince(postId string, since int64, ex } func (s *TimerLayerReactionStore) GetTopForTeamSince(teamID string, userID string, since int64, offset int, limit int) (*model.TopReactionList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ReactionStore.GetTopForTeamSince(teamID, userID, since, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5930,11 +5946,11 @@ func (s *TimerLayerReactionStore) GetTopForTeamSince(teamID string, userID strin } func (s *TimerLayerReactionStore) GetTopForUserSince(userID string, teamID string, since int64, offset int, limit int) (*model.TopReactionList, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ReactionStore.GetTopForUserSince(userID, teamID, since, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5946,11 +5962,11 @@ func (s *TimerLayerReactionStore) GetTopForUserSince(userID string, teamID strin } func (s *TimerLayerReactionStore) PermanentDeleteBatch(endTime int64, limit int64) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ReactionStore.PermanentDeleteBatch(endTime, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5962,11 +5978,11 @@ func (s *TimerLayerReactionStore) PermanentDeleteBatch(endTime int64, limit int6 } func (s *TimerLayerReactionStore) Save(reaction *model.Reaction) (*model.Reaction, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ReactionStore.Save(reaction) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5978,11 +5994,11 @@ func (s *TimerLayerReactionStore) Save(reaction *model.Reaction) (*model.Reactio } func (s *TimerLayerRemoteClusterStore) Delete(remoteClusterId string) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RemoteClusterStore.Delete(remoteClusterId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -5994,11 +6010,11 @@ func (s *TimerLayerRemoteClusterStore) Delete(remoteClusterId string) (bool, err } func (s *TimerLayerRemoteClusterStore) Get(remoteClusterId string) (*model.RemoteCluster, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RemoteClusterStore.Get(remoteClusterId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6010,11 +6026,11 @@ func (s *TimerLayerRemoteClusterStore) Get(remoteClusterId string) (*model.Remot } func (s *TimerLayerRemoteClusterStore) GetAll(filter model.RemoteClusterQueryFilter) ([]*model.RemoteCluster, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RemoteClusterStore.GetAll(filter) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6026,11 +6042,11 @@ func (s *TimerLayerRemoteClusterStore) GetAll(filter model.RemoteClusterQueryFil } func (s *TimerLayerRemoteClusterStore) Save(rc *model.RemoteCluster) (*model.RemoteCluster, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RemoteClusterStore.Save(rc) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6042,11 +6058,11 @@ func (s *TimerLayerRemoteClusterStore) Save(rc *model.RemoteCluster) (*model.Rem } func (s *TimerLayerRemoteClusterStore) SetLastPingAt(remoteClusterId string) error { - start := timemodule.Now() + start := time.Now() err := s.RemoteClusterStore.SetLastPingAt(remoteClusterId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6058,11 +6074,11 @@ func (s *TimerLayerRemoteClusterStore) SetLastPingAt(remoteClusterId string) err } func (s *TimerLayerRemoteClusterStore) Update(rc *model.RemoteCluster) (*model.RemoteCluster, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RemoteClusterStore.Update(rc) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6074,11 +6090,11 @@ func (s *TimerLayerRemoteClusterStore) Update(rc *model.RemoteCluster) (*model.R } func (s *TimerLayerRemoteClusterStore) UpdateTopics(remoteClusterId string, topics string) (*model.RemoteCluster, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RemoteClusterStore.UpdateTopics(remoteClusterId, topics) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6090,11 +6106,11 @@ func (s *TimerLayerRemoteClusterStore) UpdateTopics(remoteClusterId string, topi } func (s *TimerLayerRetentionPolicyStore) AddChannels(policyId string, channelIds []string) error { - start := timemodule.Now() + start := time.Now() err := s.RetentionPolicyStore.AddChannels(policyId, channelIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6106,11 +6122,11 @@ func (s *TimerLayerRetentionPolicyStore) AddChannels(policyId string, channelIds } func (s *TimerLayerRetentionPolicyStore) AddTeams(policyId string, teamIds []string) error { - start := timemodule.Now() + start := time.Now() err := s.RetentionPolicyStore.AddTeams(policyId, teamIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6122,11 +6138,11 @@ func (s *TimerLayerRetentionPolicyStore) AddTeams(policyId string, teamIds []str } func (s *TimerLayerRetentionPolicyStore) Delete(id string) error { - start := timemodule.Now() + start := time.Now() err := s.RetentionPolicyStore.Delete(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6138,11 +6154,11 @@ func (s *TimerLayerRetentionPolicyStore) Delete(id string) error { } func (s *TimerLayerRetentionPolicyStore) DeleteOrphanedRows(limit int) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.DeleteOrphanedRows(limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6154,11 +6170,11 @@ func (s *TimerLayerRetentionPolicyStore) DeleteOrphanedRows(limit int) (int64, e } func (s *TimerLayerRetentionPolicyStore) Get(id string) (*model.RetentionPolicyWithTeamAndChannelCounts, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.Get(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6170,11 +6186,11 @@ func (s *TimerLayerRetentionPolicyStore) Get(id string) (*model.RetentionPolicyW } func (s *TimerLayerRetentionPolicyStore) GetAll(offset int, limit int) ([]*model.RetentionPolicyWithTeamAndChannelCounts, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.GetAll(offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6186,11 +6202,11 @@ func (s *TimerLayerRetentionPolicyStore) GetAll(offset int, limit int) ([]*model } func (s *TimerLayerRetentionPolicyStore) GetChannelPoliciesCountForUser(userID string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.GetChannelPoliciesCountForUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6202,11 +6218,11 @@ func (s *TimerLayerRetentionPolicyStore) GetChannelPoliciesCountForUser(userID s } func (s *TimerLayerRetentionPolicyStore) GetChannelPoliciesForUser(userID string, offset int, limit int) ([]*model.RetentionPolicyForChannel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.GetChannelPoliciesForUser(userID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6218,11 +6234,11 @@ func (s *TimerLayerRetentionPolicyStore) GetChannelPoliciesForUser(userID string } func (s *TimerLayerRetentionPolicyStore) GetChannels(policyId string, offset int, limit int) (model.ChannelListWithTeamData, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.GetChannels(policyId, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6234,11 +6250,11 @@ func (s *TimerLayerRetentionPolicyStore) GetChannels(policyId string, offset int } func (s *TimerLayerRetentionPolicyStore) GetChannelsCount(policyId string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.GetChannelsCount(policyId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6250,11 +6266,11 @@ func (s *TimerLayerRetentionPolicyStore) GetChannelsCount(policyId string) (int6 } func (s *TimerLayerRetentionPolicyStore) GetCount() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.GetCount() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6266,11 +6282,11 @@ func (s *TimerLayerRetentionPolicyStore) GetCount() (int64, error) { } func (s *TimerLayerRetentionPolicyStore) GetTeamPoliciesCountForUser(userID string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.GetTeamPoliciesCountForUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6282,11 +6298,11 @@ func (s *TimerLayerRetentionPolicyStore) GetTeamPoliciesCountForUser(userID stri } func (s *TimerLayerRetentionPolicyStore) GetTeamPoliciesForUser(userID string, offset int, limit int) ([]*model.RetentionPolicyForTeam, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.GetTeamPoliciesForUser(userID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6298,11 +6314,11 @@ func (s *TimerLayerRetentionPolicyStore) GetTeamPoliciesForUser(userID string, o } func (s *TimerLayerRetentionPolicyStore) GetTeams(policyId string, offset int, limit int) ([]*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.GetTeams(policyId, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6314,11 +6330,11 @@ func (s *TimerLayerRetentionPolicyStore) GetTeams(policyId string, offset int, l } func (s *TimerLayerRetentionPolicyStore) GetTeamsCount(policyId string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.GetTeamsCount(policyId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6330,11 +6346,11 @@ func (s *TimerLayerRetentionPolicyStore) GetTeamsCount(policyId string) (int64, } func (s *TimerLayerRetentionPolicyStore) Patch(patch *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.Patch(patch) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6346,11 +6362,11 @@ func (s *TimerLayerRetentionPolicyStore) Patch(patch *model.RetentionPolicyWithT } func (s *TimerLayerRetentionPolicyStore) RemoveChannels(policyId string, channelIds []string) error { - start := timemodule.Now() + start := time.Now() err := s.RetentionPolicyStore.RemoveChannels(policyId, channelIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6362,11 +6378,11 @@ func (s *TimerLayerRetentionPolicyStore) RemoveChannels(policyId string, channel } func (s *TimerLayerRetentionPolicyStore) RemoveTeams(policyId string, teamIds []string) error { - start := timemodule.Now() + start := time.Now() err := s.RetentionPolicyStore.RemoveTeams(policyId, teamIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6378,11 +6394,11 @@ func (s *TimerLayerRetentionPolicyStore) RemoveTeams(policyId string, teamIds [] } func (s *TimerLayerRetentionPolicyStore) Save(policy *model.RetentionPolicyWithTeamAndChannelIDs) (*model.RetentionPolicyWithTeamAndChannelCounts, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RetentionPolicyStore.Save(policy) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6394,11 +6410,11 @@ func (s *TimerLayerRetentionPolicyStore) Save(policy *model.RetentionPolicyWithT } func (s *TimerLayerRoleStore) AllChannelSchemeRoles() ([]*model.Role, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RoleStore.AllChannelSchemeRoles() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6410,11 +6426,11 @@ func (s *TimerLayerRoleStore) AllChannelSchemeRoles() ([]*model.Role, error) { } func (s *TimerLayerRoleStore) ChannelHigherScopedPermissions(roleNames []string) (map[string]*model.RolePermissions, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RoleStore.ChannelHigherScopedPermissions(roleNames) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6426,11 +6442,11 @@ func (s *TimerLayerRoleStore) ChannelHigherScopedPermissions(roleNames []string) } func (s *TimerLayerRoleStore) ChannelRolesUnderTeamRole(roleName string) ([]*model.Role, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RoleStore.ChannelRolesUnderTeamRole(roleName) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6442,11 +6458,11 @@ func (s *TimerLayerRoleStore) ChannelRolesUnderTeamRole(roleName string) ([]*mod } func (s *TimerLayerRoleStore) Delete(roleID string) (*model.Role, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RoleStore.Delete(roleID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6458,11 +6474,11 @@ func (s *TimerLayerRoleStore) Delete(roleID string) (*model.Role, error) { } func (s *TimerLayerRoleStore) Get(roleID string) (*model.Role, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RoleStore.Get(roleID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6474,11 +6490,11 @@ func (s *TimerLayerRoleStore) Get(roleID string) (*model.Role, error) { } func (s *TimerLayerRoleStore) GetAll() ([]*model.Role, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RoleStore.GetAll() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6490,11 +6506,11 @@ func (s *TimerLayerRoleStore) GetAll() ([]*model.Role, error) { } func (s *TimerLayerRoleStore) GetByName(ctx context.Context, name string) (*model.Role, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RoleStore.GetByName(ctx, name) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6506,11 +6522,11 @@ func (s *TimerLayerRoleStore) GetByName(ctx context.Context, name string) (*mode } func (s *TimerLayerRoleStore) GetByNames(names []string) ([]*model.Role, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RoleStore.GetByNames(names) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6522,11 +6538,11 @@ func (s *TimerLayerRoleStore) GetByNames(names []string) ([]*model.Role, error) } func (s *TimerLayerRoleStore) PermanentDeleteAll() error { - start := timemodule.Now() + start := time.Now() err := s.RoleStore.PermanentDeleteAll() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6538,11 +6554,11 @@ func (s *TimerLayerRoleStore) PermanentDeleteAll() error { } func (s *TimerLayerRoleStore) Save(role *model.Role) (*model.Role, error) { - start := timemodule.Now() + start := time.Now() result, err := s.RoleStore.Save(role) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6554,11 +6570,11 @@ func (s *TimerLayerRoleStore) Save(role *model.Role) (*model.Role, error) { } func (s *TimerLayerSchemeStore) CountByScope(scope string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SchemeStore.CountByScope(scope) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6570,11 +6586,11 @@ func (s *TimerLayerSchemeStore) CountByScope(scope string) (int64, error) { } func (s *TimerLayerSchemeStore) CountWithoutPermission(scope string, permissionID string, roleScope model.RoleScope, roleType model.RoleType) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SchemeStore.CountWithoutPermission(scope, permissionID, roleScope, roleType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6586,11 +6602,11 @@ func (s *TimerLayerSchemeStore) CountWithoutPermission(scope string, permissionI } func (s *TimerLayerSchemeStore) Delete(schemeID string) (*model.Scheme, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SchemeStore.Delete(schemeID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6602,11 +6618,11 @@ func (s *TimerLayerSchemeStore) Delete(schemeID string) (*model.Scheme, error) { } func (s *TimerLayerSchemeStore) Get(schemeID string) (*model.Scheme, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SchemeStore.Get(schemeID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6618,11 +6634,11 @@ func (s *TimerLayerSchemeStore) Get(schemeID string) (*model.Scheme, error) { } func (s *TimerLayerSchemeStore) GetAllPage(scope string, offset int, limit int) ([]*model.Scheme, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SchemeStore.GetAllPage(scope, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6634,11 +6650,11 @@ func (s *TimerLayerSchemeStore) GetAllPage(scope string, offset int, limit int) } func (s *TimerLayerSchemeStore) GetByName(schemeName string) (*model.Scheme, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SchemeStore.GetByName(schemeName) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6650,11 +6666,11 @@ func (s *TimerLayerSchemeStore) GetByName(schemeName string) (*model.Scheme, err } func (s *TimerLayerSchemeStore) PermanentDeleteAll() error { - start := timemodule.Now() + start := time.Now() err := s.SchemeStore.PermanentDeleteAll() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6666,11 +6682,11 @@ func (s *TimerLayerSchemeStore) PermanentDeleteAll() error { } func (s *TimerLayerSchemeStore) Save(scheme *model.Scheme) (*model.Scheme, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SchemeStore.Save(scheme) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6682,11 +6698,11 @@ func (s *TimerLayerSchemeStore) Save(scheme *model.Scheme) (*model.Scheme, error } func (s *TimerLayerSessionStore) AnalyticsSessionCount() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SessionStore.AnalyticsSessionCount() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6698,11 +6714,11 @@ func (s *TimerLayerSessionStore) AnalyticsSessionCount() (int64, error) { } func (s *TimerLayerSessionStore) Cleanup(expiryTime int64, batchSize int64) error { - start := timemodule.Now() + start := time.Now() err := s.SessionStore.Cleanup(expiryTime, batchSize) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6714,11 +6730,11 @@ func (s *TimerLayerSessionStore) Cleanup(expiryTime int64, batchSize int64) erro } func (s *TimerLayerSessionStore) Get(ctx context.Context, sessionIDOrToken string) (*model.Session, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SessionStore.Get(ctx, sessionIDOrToken) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6730,11 +6746,11 @@ func (s *TimerLayerSessionStore) Get(ctx context.Context, sessionIDOrToken strin } func (s *TimerLayerSessionStore) GetLastSessionRowCreateAt() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SessionStore.GetLastSessionRowCreateAt() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6746,11 +6762,11 @@ func (s *TimerLayerSessionStore) GetLastSessionRowCreateAt() (int64, error) { } func (s *TimerLayerSessionStore) GetSessions(userID string) ([]*model.Session, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SessionStore.GetSessions(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6762,11 +6778,11 @@ func (s *TimerLayerSessionStore) GetSessions(userID string) ([]*model.Session, e } func (s *TimerLayerSessionStore) GetSessionsExpired(thresholdMillis int64, mobileOnly bool, unnotifiedOnly bool) ([]*model.Session, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SessionStore.GetSessionsExpired(thresholdMillis, mobileOnly, unnotifiedOnly) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6778,11 +6794,11 @@ func (s *TimerLayerSessionStore) GetSessionsExpired(thresholdMillis int64, mobil } func (s *TimerLayerSessionStore) GetSessionsWithActiveDeviceIds(userID string) ([]*model.Session, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SessionStore.GetSessionsWithActiveDeviceIds(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6794,11 +6810,11 @@ func (s *TimerLayerSessionStore) GetSessionsWithActiveDeviceIds(userID string) ( } func (s *TimerLayerSessionStore) PermanentDeleteSessionsByUser(teamID string) error { - start := timemodule.Now() + start := time.Now() err := s.SessionStore.PermanentDeleteSessionsByUser(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6810,11 +6826,11 @@ func (s *TimerLayerSessionStore) PermanentDeleteSessionsByUser(teamID string) er } func (s *TimerLayerSessionStore) Remove(sessionIDOrToken string) error { - start := timemodule.Now() + start := time.Now() err := s.SessionStore.Remove(sessionIDOrToken) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6826,11 +6842,11 @@ func (s *TimerLayerSessionStore) Remove(sessionIDOrToken string) error { } func (s *TimerLayerSessionStore) RemoveAllSessions() error { - start := timemodule.Now() + start := time.Now() err := s.SessionStore.RemoveAllSessions() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6842,11 +6858,11 @@ func (s *TimerLayerSessionStore) RemoveAllSessions() error { } func (s *TimerLayerSessionStore) Save(session *model.Session) (*model.Session, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SessionStore.Save(session) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6858,11 +6874,11 @@ func (s *TimerLayerSessionStore) Save(session *model.Session) (*model.Session, e } func (s *TimerLayerSessionStore) UpdateDeviceId(id string, deviceID string, expiresAt int64) (string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SessionStore.UpdateDeviceId(id, deviceID, expiresAt) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6874,11 +6890,11 @@ func (s *TimerLayerSessionStore) UpdateDeviceId(id string, deviceID string, expi } func (s *TimerLayerSessionStore) UpdateExpiredNotify(sessionid string, notified bool) error { - start := timemodule.Now() + start := time.Now() err := s.SessionStore.UpdateExpiredNotify(sessionid, notified) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6889,12 +6905,12 @@ func (s *TimerLayerSessionStore) UpdateExpiredNotify(sessionid string, notified return err } -func (s *TimerLayerSessionStore) UpdateExpiresAt(sessionID string, time int64) error { - start := timemodule.Now() +func (s *TimerLayerSessionStore) UpdateExpiresAt(sessionID string, timestamp int64) error { + start := time.Now() - err := s.SessionStore.UpdateExpiresAt(sessionID, time) + err := s.SessionStore.UpdateExpiresAt(sessionID, timestamp) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6905,12 +6921,12 @@ func (s *TimerLayerSessionStore) UpdateExpiresAt(sessionID string, time int64) e return err } -func (s *TimerLayerSessionStore) UpdateLastActivityAt(sessionID string, time int64) error { - start := timemodule.Now() +func (s *TimerLayerSessionStore) UpdateLastActivityAt(sessionID string, timestamp int64) error { + start := time.Now() - err := s.SessionStore.UpdateLastActivityAt(sessionID, time) + err := s.SessionStore.UpdateLastActivityAt(sessionID, timestamp) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6922,11 +6938,11 @@ func (s *TimerLayerSessionStore) UpdateLastActivityAt(sessionID string, time int } func (s *TimerLayerSessionStore) UpdateProps(session *model.Session) error { - start := timemodule.Now() + start := time.Now() err := s.SessionStore.UpdateProps(session) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6938,11 +6954,11 @@ func (s *TimerLayerSessionStore) UpdateProps(session *model.Session) error { } func (s *TimerLayerSessionStore) UpdateRoles(userID string, roles string) (string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SessionStore.UpdateRoles(userID, roles) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6954,11 +6970,11 @@ func (s *TimerLayerSessionStore) UpdateRoles(userID string, roles string) (strin } func (s *TimerLayerSharedChannelStore) Delete(channelId string) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.Delete(channelId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6970,11 +6986,11 @@ func (s *TimerLayerSharedChannelStore) Delete(channelId string) (bool, error) { } func (s *TimerLayerSharedChannelStore) DeleteRemote(remoteId string) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.DeleteRemote(remoteId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -6986,11 +7002,11 @@ func (s *TimerLayerSharedChannelStore) DeleteRemote(remoteId string) (bool, erro } func (s *TimerLayerSharedChannelStore) Get(channelId string) (*model.SharedChannel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.Get(channelId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7002,11 +7018,11 @@ func (s *TimerLayerSharedChannelStore) Get(channelId string) (*model.SharedChann } func (s *TimerLayerSharedChannelStore) GetAll(offset int, limit int, opts model.SharedChannelFilterOpts) ([]*model.SharedChannel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.GetAll(offset, limit, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7018,11 +7034,11 @@ func (s *TimerLayerSharedChannelStore) GetAll(offset int, limit int, opts model. } func (s *TimerLayerSharedChannelStore) GetAllCount(opts model.SharedChannelFilterOpts) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.GetAllCount(opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7034,11 +7050,11 @@ func (s *TimerLayerSharedChannelStore) GetAllCount(opts model.SharedChannelFilte } func (s *TimerLayerSharedChannelStore) GetAttachment(fileId string, remoteId string) (*model.SharedChannelAttachment, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.GetAttachment(fileId, remoteId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7050,11 +7066,11 @@ func (s *TimerLayerSharedChannelStore) GetAttachment(fileId string, remoteId str } func (s *TimerLayerSharedChannelStore) GetRemote(id string) (*model.SharedChannelRemote, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.GetRemote(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7066,11 +7082,11 @@ func (s *TimerLayerSharedChannelStore) GetRemote(id string) (*model.SharedChanne } func (s *TimerLayerSharedChannelStore) GetRemoteByIds(channelId string, remoteId string) (*model.SharedChannelRemote, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.GetRemoteByIds(channelId, remoteId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7082,11 +7098,11 @@ func (s *TimerLayerSharedChannelStore) GetRemoteByIds(channelId string, remoteId } func (s *TimerLayerSharedChannelStore) GetRemoteForUser(remoteId string, userId string) (*model.RemoteCluster, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.GetRemoteForUser(remoteId, userId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7098,11 +7114,11 @@ func (s *TimerLayerSharedChannelStore) GetRemoteForUser(remoteId string, userId } func (s *TimerLayerSharedChannelStore) GetRemotes(opts model.SharedChannelRemoteFilterOpts) ([]*model.SharedChannelRemote, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.GetRemotes(opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7114,11 +7130,11 @@ func (s *TimerLayerSharedChannelStore) GetRemotes(opts model.SharedChannelRemote } func (s *TimerLayerSharedChannelStore) GetRemotesStatus(channelId string) ([]*model.SharedChannelRemoteStatus, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.GetRemotesStatus(channelId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7130,11 +7146,11 @@ func (s *TimerLayerSharedChannelStore) GetRemotesStatus(channelId string) ([]*mo } func (s *TimerLayerSharedChannelStore) GetSingleUser(userID string, channelID string, remoteID string) (*model.SharedChannelUser, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.GetSingleUser(userID, channelID, remoteID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7146,11 +7162,11 @@ func (s *TimerLayerSharedChannelStore) GetSingleUser(userID string, channelID st } func (s *TimerLayerSharedChannelStore) GetUsersForSync(filter model.GetUsersForSyncFilter) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.GetUsersForSync(filter) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7162,11 +7178,11 @@ func (s *TimerLayerSharedChannelStore) GetUsersForSync(filter model.GetUsersForS } func (s *TimerLayerSharedChannelStore) GetUsersForUser(userID string) ([]*model.SharedChannelUser, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.GetUsersForUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7178,11 +7194,11 @@ func (s *TimerLayerSharedChannelStore) GetUsersForUser(userID string) ([]*model. } func (s *TimerLayerSharedChannelStore) HasChannel(channelID string) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.HasChannel(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7194,11 +7210,11 @@ func (s *TimerLayerSharedChannelStore) HasChannel(channelID string) (bool, error } func (s *TimerLayerSharedChannelStore) HasRemote(channelID string, remoteId string) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.HasRemote(channelID, remoteId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7210,11 +7226,11 @@ func (s *TimerLayerSharedChannelStore) HasRemote(channelID string, remoteId stri } func (s *TimerLayerSharedChannelStore) Save(sc *model.SharedChannel) (*model.SharedChannel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.Save(sc) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7226,11 +7242,11 @@ func (s *TimerLayerSharedChannelStore) Save(sc *model.SharedChannel) (*model.Sha } func (s *TimerLayerSharedChannelStore) SaveAttachment(remote *model.SharedChannelAttachment) (*model.SharedChannelAttachment, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.SaveAttachment(remote) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7242,11 +7258,11 @@ func (s *TimerLayerSharedChannelStore) SaveAttachment(remote *model.SharedChanne } func (s *TimerLayerSharedChannelStore) SaveRemote(remote *model.SharedChannelRemote) (*model.SharedChannelRemote, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.SaveRemote(remote) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7258,11 +7274,11 @@ func (s *TimerLayerSharedChannelStore) SaveRemote(remote *model.SharedChannelRem } func (s *TimerLayerSharedChannelStore) SaveUser(remote *model.SharedChannelUser) (*model.SharedChannelUser, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.SaveUser(remote) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7274,11 +7290,11 @@ func (s *TimerLayerSharedChannelStore) SaveUser(remote *model.SharedChannelUser) } func (s *TimerLayerSharedChannelStore) Update(sc *model.SharedChannel) (*model.SharedChannel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.Update(sc) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7290,11 +7306,11 @@ func (s *TimerLayerSharedChannelStore) Update(sc *model.SharedChannel) (*model.S } func (s *TimerLayerSharedChannelStore) UpdateAttachmentLastSyncAt(id string, syncTime int64) error { - start := timemodule.Now() + start := time.Now() err := s.SharedChannelStore.UpdateAttachmentLastSyncAt(id, syncTime) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7306,11 +7322,11 @@ func (s *TimerLayerSharedChannelStore) UpdateAttachmentLastSyncAt(id string, syn } func (s *TimerLayerSharedChannelStore) UpdateRemote(remote *model.SharedChannelRemote) (*model.SharedChannelRemote, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.UpdateRemote(remote) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7322,11 +7338,11 @@ func (s *TimerLayerSharedChannelStore) UpdateRemote(remote *model.SharedChannelR } func (s *TimerLayerSharedChannelStore) UpdateRemoteCursor(id string, cursor model.GetPostsSinceForSyncCursor) error { - start := timemodule.Now() + start := time.Now() err := s.SharedChannelStore.UpdateRemoteCursor(id, cursor) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7338,11 +7354,11 @@ func (s *TimerLayerSharedChannelStore) UpdateRemoteCursor(id string, cursor mode } func (s *TimerLayerSharedChannelStore) UpdateUserLastSyncAt(userID string, channelID string, remoteID string) error { - start := timemodule.Now() + start := time.Now() err := s.SharedChannelStore.UpdateUserLastSyncAt(userID, channelID, remoteID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7354,11 +7370,11 @@ func (s *TimerLayerSharedChannelStore) UpdateUserLastSyncAt(userID string, chann } func (s *TimerLayerSharedChannelStore) UpsertAttachment(remote *model.SharedChannelAttachment) (string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SharedChannelStore.UpsertAttachment(remote) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7370,11 +7386,11 @@ func (s *TimerLayerSharedChannelStore) UpsertAttachment(remote *model.SharedChan } func (s *TimerLayerStatusStore) Get(userID string) (*model.Status, error) { - start := timemodule.Now() + start := time.Now() result, err := s.StatusStore.Get(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7386,11 +7402,11 @@ func (s *TimerLayerStatusStore) Get(userID string) (*model.Status, error) { } func (s *TimerLayerStatusStore) GetByIds(userIds []string) ([]*model.Status, error) { - start := timemodule.Now() + start := time.Now() result, err := s.StatusStore.GetByIds(userIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7402,11 +7418,11 @@ func (s *TimerLayerStatusStore) GetByIds(userIds []string) ([]*model.Status, err } func (s *TimerLayerStatusStore) GetTotalActiveUsersCount() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.StatusStore.GetTotalActiveUsersCount() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7418,11 +7434,11 @@ func (s *TimerLayerStatusStore) GetTotalActiveUsersCount() (int64, error) { } func (s *TimerLayerStatusStore) ResetAll() error { - start := timemodule.Now() + start := time.Now() err := s.StatusStore.ResetAll() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7434,11 +7450,11 @@ func (s *TimerLayerStatusStore) ResetAll() error { } func (s *TimerLayerStatusStore) SaveOrUpdate(status *model.Status) error { - start := timemodule.Now() + start := time.Now() err := s.StatusStore.SaveOrUpdate(status) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7450,11 +7466,11 @@ func (s *TimerLayerStatusStore) SaveOrUpdate(status *model.Status) error { } func (s *TimerLayerStatusStore) UpdateExpiredDNDStatuses() ([]*model.Status, error) { - start := timemodule.Now() + start := time.Now() result, err := s.StatusStore.UpdateExpiredDNDStatuses() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7466,11 +7482,11 @@ func (s *TimerLayerStatusStore) UpdateExpiredDNDStatuses() ([]*model.Status, err } func (s *TimerLayerStatusStore) UpdateLastActivityAt(userID string, lastActivityAt int64) error { - start := timemodule.Now() + start := time.Now() err := s.StatusStore.UpdateLastActivityAt(userID, lastActivityAt) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7482,11 +7498,11 @@ func (s *TimerLayerStatusStore) UpdateLastActivityAt(userID string, lastActivity } func (s *TimerLayerSystemStore) Get() (model.StringMap, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SystemStore.Get() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7498,11 +7514,11 @@ func (s *TimerLayerSystemStore) Get() (model.StringMap, error) { } func (s *TimerLayerSystemStore) GetByName(name string) (*model.System, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SystemStore.GetByName(name) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7514,11 +7530,11 @@ func (s *TimerLayerSystemStore) GetByName(name string) (*model.System, error) { } func (s *TimerLayerSystemStore) InsertIfExists(system *model.System) (*model.System, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SystemStore.InsertIfExists(system) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7530,11 +7546,11 @@ func (s *TimerLayerSystemStore) InsertIfExists(system *model.System) (*model.Sys } func (s *TimerLayerSystemStore) PermanentDeleteByName(name string) (*model.System, error) { - start := timemodule.Now() + start := time.Now() result, err := s.SystemStore.PermanentDeleteByName(name) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7546,11 +7562,11 @@ func (s *TimerLayerSystemStore) PermanentDeleteByName(name string) (*model.Syste } func (s *TimerLayerSystemStore) Save(system *model.System) error { - start := timemodule.Now() + start := time.Now() err := s.SystemStore.Save(system) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7562,11 +7578,11 @@ func (s *TimerLayerSystemStore) Save(system *model.System) error { } func (s *TimerLayerSystemStore) SaveOrUpdate(system *model.System) error { - start := timemodule.Now() + start := time.Now() err := s.SystemStore.SaveOrUpdate(system) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7578,11 +7594,11 @@ func (s *TimerLayerSystemStore) SaveOrUpdate(system *model.System) error { } func (s *TimerLayerSystemStore) SaveOrUpdateWithWarnMetricHandling(system *model.System) error { - start := timemodule.Now() + start := time.Now() err := s.SystemStore.SaveOrUpdateWithWarnMetricHandling(system) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7594,11 +7610,11 @@ func (s *TimerLayerSystemStore) SaveOrUpdateWithWarnMetricHandling(system *model } func (s *TimerLayerSystemStore) Update(system *model.System) error { - start := timemodule.Now() + start := time.Now() err := s.SystemStore.Update(system) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7610,11 +7626,11 @@ func (s *TimerLayerSystemStore) Update(system *model.System) error { } func (s *TimerLayerTeamStore) AnalyticsGetTeamCountForScheme(schemeID string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.AnalyticsGetTeamCountForScheme(schemeID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7626,11 +7642,11 @@ func (s *TimerLayerTeamStore) AnalyticsGetTeamCountForScheme(schemeID string) (i } func (s *TimerLayerTeamStore) AnalyticsTeamCount(opts *model.TeamSearch) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.AnalyticsTeamCount(opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7642,11 +7658,11 @@ func (s *TimerLayerTeamStore) AnalyticsTeamCount(opts *model.TeamSearch) (int64, } func (s *TimerLayerTeamStore) ClearAllCustomRoleAssignments() error { - start := timemodule.Now() + start := time.Now() err := s.TeamStore.ClearAllCustomRoleAssignments() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7658,11 +7674,11 @@ func (s *TimerLayerTeamStore) ClearAllCustomRoleAssignments() error { } func (s *TimerLayerTeamStore) ClearCaches() { - start := timemodule.Now() + start := time.Now() s.TeamStore.ClearCaches() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -7673,11 +7689,11 @@ func (s *TimerLayerTeamStore) ClearCaches() { } func (s *TimerLayerTeamStore) Get(id string) (*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.Get(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7689,11 +7705,11 @@ func (s *TimerLayerTeamStore) Get(id string) (*model.Team, error) { } func (s *TimerLayerTeamStore) GetActiveMemberCount(teamID string, restrictions *model.ViewUsersRestrictions) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetActiveMemberCount(teamID, restrictions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7705,11 +7721,11 @@ func (s *TimerLayerTeamStore) GetActiveMemberCount(teamID string, restrictions * } func (s *TimerLayerTeamStore) GetAll() ([]*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetAll() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7721,11 +7737,11 @@ func (s *TimerLayerTeamStore) GetAll() ([]*model.Team, error) { } func (s *TimerLayerTeamStore) GetAllForExportAfter(limit int, afterID string) ([]*model.TeamForExport, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetAllForExportAfter(limit, afterID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7737,11 +7753,11 @@ func (s *TimerLayerTeamStore) GetAllForExportAfter(limit int, afterID string) ([ } func (s *TimerLayerTeamStore) GetAllPage(offset int, limit int, opts *model.TeamSearch) ([]*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetAllPage(offset, limit, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7753,11 +7769,11 @@ func (s *TimerLayerTeamStore) GetAllPage(offset int, limit int, opts *model.Team } func (s *TimerLayerTeamStore) GetAllPrivateTeamListing() ([]*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetAllPrivateTeamListing() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7769,11 +7785,11 @@ func (s *TimerLayerTeamStore) GetAllPrivateTeamListing() ([]*model.Team, error) } func (s *TimerLayerTeamStore) GetAllTeamListing() ([]*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetAllTeamListing() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7785,11 +7801,11 @@ func (s *TimerLayerTeamStore) GetAllTeamListing() ([]*model.Team, error) { } func (s *TimerLayerTeamStore) GetByEmptyInviteID() ([]*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetByEmptyInviteID() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7801,11 +7817,11 @@ func (s *TimerLayerTeamStore) GetByEmptyInviteID() ([]*model.Team, error) { } func (s *TimerLayerTeamStore) GetByInviteId(inviteID string) (*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetByInviteId(inviteID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7817,11 +7833,11 @@ func (s *TimerLayerTeamStore) GetByInviteId(inviteID string) (*model.Team, error } func (s *TimerLayerTeamStore) GetByName(name string) (*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetByName(name) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7833,11 +7849,11 @@ func (s *TimerLayerTeamStore) GetByName(name string) (*model.Team, error) { } func (s *TimerLayerTeamStore) GetByNames(name []string) ([]*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetByNames(name) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7849,11 +7865,11 @@ func (s *TimerLayerTeamStore) GetByNames(name []string) ([]*model.Team, error) { } func (s *TimerLayerTeamStore) GetChannelUnreadsForAllTeams(excludeTeamID string, userID string) ([]*model.ChannelUnread, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetChannelUnreadsForAllTeams(excludeTeamID, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7865,11 +7881,11 @@ func (s *TimerLayerTeamStore) GetChannelUnreadsForAllTeams(excludeTeamID string, } func (s *TimerLayerTeamStore) GetChannelUnreadsForTeam(teamID string, userID string) ([]*model.ChannelUnread, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetChannelUnreadsForTeam(teamID, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7881,11 +7897,11 @@ func (s *TimerLayerTeamStore) GetChannelUnreadsForTeam(teamID string, userID str } func (s *TimerLayerTeamStore) GetCommonTeamIDsForTwoUsers(userID string, otherUserID string) ([]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetCommonTeamIDsForTwoUsers(userID, otherUserID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7897,11 +7913,11 @@ func (s *TimerLayerTeamStore) GetCommonTeamIDsForTwoUsers(userID string, otherUs } func (s *TimerLayerTeamStore) GetMany(ids []string) ([]*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetMany(ids) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7913,11 +7929,11 @@ func (s *TimerLayerTeamStore) GetMany(ids []string) ([]*model.Team, error) { } func (s *TimerLayerTeamStore) GetMember(ctx context.Context, teamID string, userID string) (*model.TeamMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetMember(ctx, teamID, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7929,11 +7945,11 @@ func (s *TimerLayerTeamStore) GetMember(ctx context.Context, teamID string, user } func (s *TimerLayerTeamStore) GetMembers(teamID string, offset int, limit int, teamMembersGetOptions *model.TeamMembersGetOptions) ([]*model.TeamMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetMembers(teamID, offset, limit, teamMembersGetOptions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7945,11 +7961,11 @@ func (s *TimerLayerTeamStore) GetMembers(teamID string, offset int, limit int, t } func (s *TimerLayerTeamStore) GetMembersByIds(teamID string, userIds []string, restrictions *model.ViewUsersRestrictions) ([]*model.TeamMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetMembersByIds(teamID, userIds, restrictions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7961,11 +7977,11 @@ func (s *TimerLayerTeamStore) GetMembersByIds(teamID string, userIds []string, r } func (s *TimerLayerTeamStore) GetTeamMembersForExport(userID string) ([]*model.TeamMemberForExport, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetTeamMembersForExport(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7977,11 +7993,11 @@ func (s *TimerLayerTeamStore) GetTeamMembersForExport(userID string) ([]*model.T } func (s *TimerLayerTeamStore) GetTeamsByScheme(schemeID string, offset int, limit int) ([]*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetTeamsByScheme(schemeID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -7993,11 +8009,11 @@ func (s *TimerLayerTeamStore) GetTeamsByScheme(schemeID string, offset int, limi } func (s *TimerLayerTeamStore) GetTeamsByUserId(userID string) ([]*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetTeamsByUserId(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8009,11 +8025,11 @@ func (s *TimerLayerTeamStore) GetTeamsByUserId(userID string) ([]*model.Team, er } func (s *TimerLayerTeamStore) GetTeamsForUser(ctx context.Context, userID string, excludeTeamID string, includeDeleted bool) ([]*model.TeamMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetTeamsForUser(ctx, userID, excludeTeamID, includeDeleted) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8025,11 +8041,11 @@ func (s *TimerLayerTeamStore) GetTeamsForUser(ctx context.Context, userID string } func (s *TimerLayerTeamStore) GetTeamsForUserWithPagination(userID string, page int, perPage int) ([]*model.TeamMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetTeamsForUserWithPagination(userID, page, perPage) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8041,11 +8057,11 @@ func (s *TimerLayerTeamStore) GetTeamsForUserWithPagination(userID string, page } func (s *TimerLayerTeamStore) GetTotalMemberCount(teamID string, restrictions *model.ViewUsersRestrictions) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetTotalMemberCount(teamID, restrictions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8057,11 +8073,11 @@ func (s *TimerLayerTeamStore) GetTotalMemberCount(teamID string, restrictions *m } func (s *TimerLayerTeamStore) GetUserTeamIds(userID string, allowFromCache bool) ([]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GetUserTeamIds(userID, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8073,11 +8089,11 @@ func (s *TimerLayerTeamStore) GetUserTeamIds(userID string, allowFromCache bool) } func (s *TimerLayerTeamStore) GroupSyncedTeamCount() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.GroupSyncedTeamCount() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8089,11 +8105,11 @@ func (s *TimerLayerTeamStore) GroupSyncedTeamCount() (int64, error) { } func (s *TimerLayerTeamStore) InvalidateAllTeamIdsForUser(userID string) { - start := timemodule.Now() + start := time.Now() s.TeamStore.InvalidateAllTeamIdsForUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -8104,11 +8120,11 @@ func (s *TimerLayerTeamStore) InvalidateAllTeamIdsForUser(userID string) { } func (s *TimerLayerTeamStore) MigrateTeamMembers(fromTeamID string, fromUserID string) (map[string]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.MigrateTeamMembers(fromTeamID, fromUserID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8120,11 +8136,11 @@ func (s *TimerLayerTeamStore) MigrateTeamMembers(fromTeamID string, fromUserID s } func (s *TimerLayerTeamStore) PermanentDelete(teamID string) error { - start := timemodule.Now() + start := time.Now() err := s.TeamStore.PermanentDelete(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8136,11 +8152,11 @@ func (s *TimerLayerTeamStore) PermanentDelete(teamID string) error { } func (s *TimerLayerTeamStore) RemoveAllMembersByTeam(teamID string) error { - start := timemodule.Now() + start := time.Now() err := s.TeamStore.RemoveAllMembersByTeam(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8152,11 +8168,11 @@ func (s *TimerLayerTeamStore) RemoveAllMembersByTeam(teamID string) error { } func (s *TimerLayerTeamStore) RemoveAllMembersByUser(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.TeamStore.RemoveAllMembersByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8168,11 +8184,11 @@ func (s *TimerLayerTeamStore) RemoveAllMembersByUser(userID string) error { } func (s *TimerLayerTeamStore) RemoveMember(teamID string, userID string) error { - start := timemodule.Now() + start := time.Now() err := s.TeamStore.RemoveMember(teamID, userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8184,11 +8200,11 @@ func (s *TimerLayerTeamStore) RemoveMember(teamID string, userID string) error { } func (s *TimerLayerTeamStore) RemoveMembers(teamID string, userIds []string) error { - start := timemodule.Now() + start := time.Now() err := s.TeamStore.RemoveMembers(teamID, userIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8200,11 +8216,11 @@ func (s *TimerLayerTeamStore) RemoveMembers(teamID string, userIds []string) err } func (s *TimerLayerTeamStore) ResetAllTeamSchemes() error { - start := timemodule.Now() + start := time.Now() err := s.TeamStore.ResetAllTeamSchemes() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8216,11 +8232,11 @@ func (s *TimerLayerTeamStore) ResetAllTeamSchemes() error { } func (s *TimerLayerTeamStore) Save(team *model.Team) (*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.Save(team) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8232,11 +8248,11 @@ func (s *TimerLayerTeamStore) Save(team *model.Team) (*model.Team, error) { } func (s *TimerLayerTeamStore) SaveMember(member *model.TeamMember, maxUsersPerTeam int) (*model.TeamMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.SaveMember(member, maxUsersPerTeam) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8248,11 +8264,11 @@ func (s *TimerLayerTeamStore) SaveMember(member *model.TeamMember, maxUsersPerTe } func (s *TimerLayerTeamStore) SaveMultipleMembers(members []*model.TeamMember, maxUsersPerTeam int) ([]*model.TeamMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.SaveMultipleMembers(members, maxUsersPerTeam) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8264,11 +8280,11 @@ func (s *TimerLayerTeamStore) SaveMultipleMembers(members []*model.TeamMember, m } func (s *TimerLayerTeamStore) SearchAll(opts *model.TeamSearch) ([]*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.SearchAll(opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8280,11 +8296,11 @@ func (s *TimerLayerTeamStore) SearchAll(opts *model.TeamSearch) ([]*model.Team, } func (s *TimerLayerTeamStore) SearchAllPaged(opts *model.TeamSearch) ([]*model.Team, int64, error) { - start := timemodule.Now() + start := time.Now() result, resultVar1, err := s.TeamStore.SearchAllPaged(opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8296,11 +8312,11 @@ func (s *TimerLayerTeamStore) SearchAllPaged(opts *model.TeamSearch) ([]*model.T } func (s *TimerLayerTeamStore) SearchOpen(opts *model.TeamSearch) ([]*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.SearchOpen(opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8312,11 +8328,11 @@ func (s *TimerLayerTeamStore) SearchOpen(opts *model.TeamSearch) ([]*model.Team, } func (s *TimerLayerTeamStore) SearchPrivate(opts *model.TeamSearch) ([]*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.SearchPrivate(opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8328,11 +8344,11 @@ func (s *TimerLayerTeamStore) SearchPrivate(opts *model.TeamSearch) ([]*model.Te } func (s *TimerLayerTeamStore) Update(team *model.Team) (*model.Team, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.Update(team) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8344,11 +8360,11 @@ func (s *TimerLayerTeamStore) Update(team *model.Team) (*model.Team, error) { } func (s *TimerLayerTeamStore) UpdateLastTeamIconUpdate(teamID string, curTime int64) error { - start := timemodule.Now() + start := time.Now() err := s.TeamStore.UpdateLastTeamIconUpdate(teamID, curTime) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8360,11 +8376,11 @@ func (s *TimerLayerTeamStore) UpdateLastTeamIconUpdate(teamID string, curTime in } func (s *TimerLayerTeamStore) UpdateMember(member *model.TeamMember) (*model.TeamMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.UpdateMember(member) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8376,11 +8392,11 @@ func (s *TimerLayerTeamStore) UpdateMember(member *model.TeamMember) (*model.Tea } func (s *TimerLayerTeamStore) UpdateMembersRole(teamID string, userIDs []string) error { - start := timemodule.Now() + start := time.Now() err := s.TeamStore.UpdateMembersRole(teamID, userIDs) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8392,11 +8408,11 @@ func (s *TimerLayerTeamStore) UpdateMembersRole(teamID string, userIDs []string) } func (s *TimerLayerTeamStore) UpdateMultipleMembers(members []*model.TeamMember) ([]*model.TeamMember, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.UpdateMultipleMembers(members) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8408,11 +8424,11 @@ func (s *TimerLayerTeamStore) UpdateMultipleMembers(members []*model.TeamMember) } func (s *TimerLayerTeamStore) UserBelongsToTeams(userID string, teamIds []string) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TeamStore.UserBelongsToTeams(userID, teamIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8424,11 +8440,11 @@ func (s *TimerLayerTeamStore) UserBelongsToTeams(userID string, teamIds []string } func (s *TimerLayerTermsOfServiceStore) Get(id string, allowFromCache bool) (*model.TermsOfService, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TermsOfServiceStore.Get(id, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8440,11 +8456,11 @@ func (s *TimerLayerTermsOfServiceStore) Get(id string, allowFromCache bool) (*mo } func (s *TimerLayerTermsOfServiceStore) GetLatest(allowFromCache bool) (*model.TermsOfService, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TermsOfServiceStore.GetLatest(allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8456,11 +8472,11 @@ func (s *TimerLayerTermsOfServiceStore) GetLatest(allowFromCache bool) (*model.T } func (s *TimerLayerTermsOfServiceStore) Save(termsOfService *model.TermsOfService) (*model.TermsOfService, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TermsOfServiceStore.Save(termsOfService) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8472,11 +8488,11 @@ func (s *TimerLayerTermsOfServiceStore) Save(termsOfService *model.TermsOfServic } func (s *TimerLayerThreadStore) DeleteMembershipForUser(userId string, postID string) error { - start := timemodule.Now() + start := time.Now() err := s.ThreadStore.DeleteMembershipForUser(userId, postID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8488,11 +8504,11 @@ func (s *TimerLayerThreadStore) DeleteMembershipForUser(userId string, postID st } func (s *TimerLayerThreadStore) DeleteOrphanedRows(limit int) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.DeleteOrphanedRows(limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8504,11 +8520,11 @@ func (s *TimerLayerThreadStore) DeleteOrphanedRows(limit int) (int64, error) { } func (s *TimerLayerThreadStore) Get(id string) (*model.Thread, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.Get(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8520,11 +8536,11 @@ func (s *TimerLayerThreadStore) Get(id string) (*model.Thread, error) { } func (s *TimerLayerThreadStore) GetMembershipForUser(userId string, postID string) (*model.ThreadMembership, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.GetMembershipForUser(userId, postID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8536,11 +8552,11 @@ func (s *TimerLayerThreadStore) GetMembershipForUser(userId string, postID strin } func (s *TimerLayerThreadStore) GetMembershipsForUser(userId string, teamID string) ([]*model.ThreadMembership, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.GetMembershipsForUser(userId, teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8552,11 +8568,11 @@ func (s *TimerLayerThreadStore) GetMembershipsForUser(userId string, teamID stri } func (s *TimerLayerThreadStore) GetPosts(threadID string, since int64) ([]*model.Post, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.GetPosts(threadID, since) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8568,11 +8584,11 @@ func (s *TimerLayerThreadStore) GetPosts(threadID string, since int64) ([]*model } func (s *TimerLayerThreadStore) GetTeamsUnreadForUser(userID string, teamIDs []string) (map[string]*model.TeamUnread, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.GetTeamsUnreadForUser(userID, teamIDs) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8584,11 +8600,11 @@ func (s *TimerLayerThreadStore) GetTeamsUnreadForUser(userID string, teamIDs []s } func (s *TimerLayerThreadStore) GetThreadFollowers(threadID string, fetchOnlyActive bool) ([]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.GetThreadFollowers(threadID, fetchOnlyActive) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8600,11 +8616,11 @@ func (s *TimerLayerThreadStore) GetThreadFollowers(threadID string, fetchOnlyAct } func (s *TimerLayerThreadStore) GetThreadForUser(teamID string, threadMembership *model.ThreadMembership, extended bool) (*model.ThreadResponse, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.GetThreadForUser(teamID, threadMembership, extended) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8616,11 +8632,11 @@ func (s *TimerLayerThreadStore) GetThreadForUser(teamID string, threadMembership } func (s *TimerLayerThreadStore) GetThreadUnreadReplyCount(threadMembership *model.ThreadMembership) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.GetThreadUnreadReplyCount(threadMembership) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8632,11 +8648,11 @@ func (s *TimerLayerThreadStore) GetThreadUnreadReplyCount(threadMembership *mode } func (s *TimerLayerThreadStore) GetThreadsForUser(userId string, teamID string, opts model.GetUserThreadsOpts) ([]*model.ThreadResponse, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.GetThreadsForUser(userId, teamID, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8648,11 +8664,11 @@ func (s *TimerLayerThreadStore) GetThreadsForUser(userId string, teamID string, } func (s *TimerLayerThreadStore) GetTotalThreads(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.GetTotalThreads(userId, teamID, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8664,11 +8680,11 @@ func (s *TimerLayerThreadStore) GetTotalThreads(userId string, teamID string, op } func (s *TimerLayerThreadStore) GetTotalUnreadMentions(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.GetTotalUnreadMentions(userId, teamID, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8680,11 +8696,11 @@ func (s *TimerLayerThreadStore) GetTotalUnreadMentions(userId string, teamID str } func (s *TimerLayerThreadStore) GetTotalUnreadThreads(userId string, teamID string, opts model.GetUserThreadsOpts) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.GetTotalUnreadThreads(userId, teamID, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8696,11 +8712,11 @@ func (s *TimerLayerThreadStore) GetTotalUnreadThreads(userId string, teamID stri } func (s *TimerLayerThreadStore) MaintainMembership(userID string, postID string, opts store.ThreadMembershipOpts) (*model.ThreadMembership, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.MaintainMembership(userID, postID, opts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8712,11 +8728,11 @@ func (s *TimerLayerThreadStore) MaintainMembership(userID string, postID string, } func (s *TimerLayerThreadStore) MarkAllAsRead(userID string, threadIds []string) error { - start := timemodule.Now() + start := time.Now() err := s.ThreadStore.MarkAllAsRead(userID, threadIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8728,11 +8744,11 @@ func (s *TimerLayerThreadStore) MarkAllAsRead(userID string, threadIds []string) } func (s *TimerLayerThreadStore) MarkAllAsReadByChannels(userID string, channelIDs []string) error { - start := timemodule.Now() + start := time.Now() err := s.ThreadStore.MarkAllAsReadByChannels(userID, channelIDs) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8744,11 +8760,11 @@ func (s *TimerLayerThreadStore) MarkAllAsReadByChannels(userID string, channelID } func (s *TimerLayerThreadStore) MarkAllAsReadByTeam(userID string, teamID string) error { - start := timemodule.Now() + start := time.Now() err := s.ThreadStore.MarkAllAsReadByTeam(userID, teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8760,11 +8776,11 @@ func (s *TimerLayerThreadStore) MarkAllAsReadByTeam(userID string, teamID string } func (s *TimerLayerThreadStore) MarkAsRead(userID string, threadID string, timestamp int64) error { - start := timemodule.Now() + start := time.Now() err := s.ThreadStore.MarkAsRead(userID, threadID, timestamp) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8776,11 +8792,11 @@ func (s *TimerLayerThreadStore) MarkAsRead(userID string, threadID string, times } func (s *TimerLayerThreadStore) PermanentDeleteBatchForRetentionPolicies(now int64, globalPolicyEndTime int64, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) { - start := timemodule.Now() + start := time.Now() result, resultVar1, err := s.ThreadStore.PermanentDeleteBatchForRetentionPolicies(now, globalPolicyEndTime, limit, cursor) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8792,11 +8808,11 @@ func (s *TimerLayerThreadStore) PermanentDeleteBatchForRetentionPolicies(now int } func (s *TimerLayerThreadStore) PermanentDeleteBatchThreadMembershipsForRetentionPolicies(now int64, globalPolicyEndTime int64, limit int64, cursor model.RetentionPolicyCursor) (int64, model.RetentionPolicyCursor, error) { - start := timemodule.Now() + start := time.Now() result, resultVar1, err := s.ThreadStore.PermanentDeleteBatchThreadMembershipsForRetentionPolicies(now, globalPolicyEndTime, limit, cursor) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8808,11 +8824,11 @@ func (s *TimerLayerThreadStore) PermanentDeleteBatchThreadMembershipsForRetentio } func (s *TimerLayerThreadStore) UpdateMembership(membership *model.ThreadMembership) (*model.ThreadMembership, error) { - start := timemodule.Now() + start := time.Now() result, err := s.ThreadStore.UpdateMembership(membership) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8824,11 +8840,11 @@ func (s *TimerLayerThreadStore) UpdateMembership(membership *model.ThreadMembers } func (s *TimerLayerTokenStore) Cleanup(expiryTime int64) { - start := timemodule.Now() + start := time.Now() s.TokenStore.Cleanup(expiryTime) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -8839,11 +8855,11 @@ func (s *TimerLayerTokenStore) Cleanup(expiryTime int64) { } func (s *TimerLayerTokenStore) Delete(token string) error { - start := timemodule.Now() + start := time.Now() err := s.TokenStore.Delete(token) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8855,11 +8871,11 @@ func (s *TimerLayerTokenStore) Delete(token string) error { } func (s *TimerLayerTokenStore) GetAllTokensByType(tokenType string) ([]*model.Token, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TokenStore.GetAllTokensByType(tokenType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8871,11 +8887,11 @@ func (s *TimerLayerTokenStore) GetAllTokensByType(tokenType string) ([]*model.To } func (s *TimerLayerTokenStore) GetByToken(token string) (*model.Token, error) { - start := timemodule.Now() + start := time.Now() result, err := s.TokenStore.GetByToken(token) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8887,11 +8903,11 @@ func (s *TimerLayerTokenStore) GetByToken(token string) (*model.Token, error) { } func (s *TimerLayerTokenStore) RemoveAllTokensByType(tokenType string) error { - start := timemodule.Now() + start := time.Now() err := s.TokenStore.RemoveAllTokensByType(tokenType) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8903,11 +8919,11 @@ func (s *TimerLayerTokenStore) RemoveAllTokensByType(tokenType string) error { } func (s *TimerLayerTokenStore) Save(recovery *model.Token) error { - start := timemodule.Now() + start := time.Now() err := s.TokenStore.Save(recovery) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8919,11 +8935,11 @@ func (s *TimerLayerTokenStore) Save(recovery *model.Token) error { } func (s *TimerLayerUploadSessionStore) Delete(id string) error { - start := timemodule.Now() + start := time.Now() err := s.UploadSessionStore.Delete(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8935,11 +8951,11 @@ func (s *TimerLayerUploadSessionStore) Delete(id string) error { } func (s *TimerLayerUploadSessionStore) Get(id string) (*model.UploadSession, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UploadSessionStore.Get(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8951,11 +8967,11 @@ func (s *TimerLayerUploadSessionStore) Get(id string) (*model.UploadSession, err } func (s *TimerLayerUploadSessionStore) GetForUser(userID string) ([]*model.UploadSession, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UploadSessionStore.GetForUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8967,11 +8983,11 @@ func (s *TimerLayerUploadSessionStore) GetForUser(userID string) ([]*model.Uploa } func (s *TimerLayerUploadSessionStore) Save(session *model.UploadSession) (*model.UploadSession, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UploadSessionStore.Save(session) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8983,11 +8999,11 @@ func (s *TimerLayerUploadSessionStore) Save(session *model.UploadSession) (*mode } func (s *TimerLayerUploadSessionStore) Update(session *model.UploadSession) error { - start := timemodule.Now() + start := time.Now() err := s.UploadSessionStore.Update(session) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -8998,12 +9014,12 @@ func (s *TimerLayerUploadSessionStore) Update(session *model.UploadSession) erro return err } -func (s *TimerLayerUserStore) AnalyticsActiveCount(time int64, options model.UserCountOptions) (int64, error) { - start := timemodule.Now() +func (s *TimerLayerUserStore) AnalyticsActiveCount(timestamp int64, options model.UserCountOptions) (int64, error) { + start := time.Now() - result, err := s.UserStore.AnalyticsActiveCount(time, options) + result, err := s.UserStore.AnalyticsActiveCount(timestamp, options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9015,11 +9031,11 @@ func (s *TimerLayerUserStore) AnalyticsActiveCount(time int64, options model.Use } func (s *TimerLayerUserStore) AnalyticsActiveCountForPeriod(startTime int64, endTime int64, options model.UserCountOptions) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.AnalyticsActiveCountForPeriod(startTime, endTime, options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9031,11 +9047,11 @@ func (s *TimerLayerUserStore) AnalyticsActiveCountForPeriod(startTime int64, end } func (s *TimerLayerUserStore) AnalyticsGetExternalUsers(hostDomain string) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.AnalyticsGetExternalUsers(hostDomain) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9047,11 +9063,11 @@ func (s *TimerLayerUserStore) AnalyticsGetExternalUsers(hostDomain string) (bool } func (s *TimerLayerUserStore) AnalyticsGetGuestCount() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.AnalyticsGetGuestCount() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9063,11 +9079,11 @@ func (s *TimerLayerUserStore) AnalyticsGetGuestCount() (int64, error) { } func (s *TimerLayerUserStore) AnalyticsGetInactiveUsersCount() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.AnalyticsGetInactiveUsersCount() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9079,11 +9095,11 @@ func (s *TimerLayerUserStore) AnalyticsGetInactiveUsersCount() (int64, error) { } func (s *TimerLayerUserStore) AnalyticsGetSystemAdminCount() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.AnalyticsGetSystemAdminCount() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9095,11 +9111,11 @@ func (s *TimerLayerUserStore) AnalyticsGetSystemAdminCount() (int64, error) { } func (s *TimerLayerUserStore) AutocompleteUsersInChannel(teamID string, channelID string, term string, options *model.UserSearchOptions) (*model.UserAutocompleteInChannel, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.AutocompleteUsersInChannel(teamID, channelID, term, options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9111,11 +9127,11 @@ func (s *TimerLayerUserStore) AutocompleteUsersInChannel(teamID string, channelI } func (s *TimerLayerUserStore) ClearAllCustomRoleAssignments() error { - start := timemodule.Now() + start := time.Now() err := s.UserStore.ClearAllCustomRoleAssignments() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9127,11 +9143,11 @@ func (s *TimerLayerUserStore) ClearAllCustomRoleAssignments() error { } func (s *TimerLayerUserStore) ClearCaches() { - start := timemodule.Now() + start := time.Now() s.UserStore.ClearCaches() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -9142,11 +9158,11 @@ func (s *TimerLayerUserStore) ClearCaches() { } func (s *TimerLayerUserStore) Count(options model.UserCountOptions) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.Count(options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9158,11 +9174,11 @@ func (s *TimerLayerUserStore) Count(options model.UserCountOptions) (int64, erro } func (s *TimerLayerUserStore) DeactivateGuests() ([]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.DeactivateGuests() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9174,11 +9190,11 @@ func (s *TimerLayerUserStore) DeactivateGuests() ([]string, error) { } func (s *TimerLayerUserStore) DemoteUserToGuest(userID string) (*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.DemoteUserToGuest(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9190,11 +9206,11 @@ func (s *TimerLayerUserStore) DemoteUserToGuest(userID string) (*model.User, err } func (s *TimerLayerUserStore) Get(ctx context.Context, id string) (*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.Get(ctx, id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9206,11 +9222,11 @@ func (s *TimerLayerUserStore) Get(ctx context.Context, id string) (*model.User, } func (s *TimerLayerUserStore) GetAll() ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetAll() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9222,11 +9238,11 @@ func (s *TimerLayerUserStore) GetAll() ([]*model.User, error) { } func (s *TimerLayerUserStore) GetAllAfter(limit int, afterID string) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetAllAfter(limit, afterID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9238,11 +9254,11 @@ func (s *TimerLayerUserStore) GetAllAfter(limit int, afterID string) ([]*model.U } func (s *TimerLayerUserStore) GetAllNotInAuthService(authServices []string) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetAllNotInAuthService(authServices) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9254,11 +9270,11 @@ func (s *TimerLayerUserStore) GetAllNotInAuthService(authServices []string) ([]* } func (s *TimerLayerUserStore) GetAllProfiles(options *model.UserGetOptions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetAllProfiles(options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9270,11 +9286,11 @@ func (s *TimerLayerUserStore) GetAllProfiles(options *model.UserGetOptions) ([]* } func (s *TimerLayerUserStore) GetAllProfilesInChannel(ctx context.Context, channelID string, allowFromCache bool) (map[string]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetAllProfilesInChannel(ctx, channelID, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9286,11 +9302,11 @@ func (s *TimerLayerUserStore) GetAllProfilesInChannel(ctx context.Context, chann } func (s *TimerLayerUserStore) GetAllUsingAuthService(authService string) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetAllUsingAuthService(authService) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9302,11 +9318,11 @@ func (s *TimerLayerUserStore) GetAllUsingAuthService(authService string) ([]*mod } func (s *TimerLayerUserStore) GetAnyUnreadPostCountForChannel(userID string, channelID string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetAnyUnreadPostCountForChannel(userID, channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9318,11 +9334,11 @@ func (s *TimerLayerUserStore) GetAnyUnreadPostCountForChannel(userID string, cha } func (s *TimerLayerUserStore) GetByAuth(authData *string, authService string) (*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetByAuth(authData, authService) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9334,11 +9350,11 @@ func (s *TimerLayerUserStore) GetByAuth(authData *string, authService string) (* } func (s *TimerLayerUserStore) GetByEmail(email string) (*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetByEmail(email) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9350,11 +9366,11 @@ func (s *TimerLayerUserStore) GetByEmail(email string) (*model.User, error) { } func (s *TimerLayerUserStore) GetByUsername(username string) (*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetByUsername(username) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9366,11 +9382,11 @@ func (s *TimerLayerUserStore) GetByUsername(username string) (*model.User, error } func (s *TimerLayerUserStore) GetChannelGroupUsers(channelID string) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetChannelGroupUsers(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9382,11 +9398,11 @@ func (s *TimerLayerUserStore) GetChannelGroupUsers(channelID string) ([]*model.U } func (s *TimerLayerUserStore) GetEtagForAllProfiles() string { - start := timemodule.Now() + start := time.Now() result := s.UserStore.GetEtagForAllProfiles() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -9398,11 +9414,11 @@ func (s *TimerLayerUserStore) GetEtagForAllProfiles() string { } func (s *TimerLayerUserStore) GetEtagForProfiles(teamID string) string { - start := timemodule.Now() + start := time.Now() result := s.UserStore.GetEtagForProfiles(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -9414,11 +9430,11 @@ func (s *TimerLayerUserStore) GetEtagForProfiles(teamID string) string { } func (s *TimerLayerUserStore) GetEtagForProfilesNotInTeam(teamID string) string { - start := timemodule.Now() + start := time.Now() result := s.UserStore.GetEtagForProfilesNotInTeam(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -9430,11 +9446,11 @@ func (s *TimerLayerUserStore) GetEtagForProfilesNotInTeam(teamID string) string } func (s *TimerLayerUserStore) GetForLogin(loginID string, allowSignInWithUsername bool, allowSignInWithEmail bool) (*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetForLogin(loginID, allowSignInWithUsername, allowSignInWithEmail) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9446,11 +9462,11 @@ func (s *TimerLayerUserStore) GetForLogin(loginID string, allowSignInWithUsernam } func (s *TimerLayerUserStore) GetKnownUsers(userID string) ([]string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetKnownUsers(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9462,11 +9478,11 @@ func (s *TimerLayerUserStore) GetKnownUsers(userID string) ([]string, error) { } func (s *TimerLayerUserStore) GetMany(ctx context.Context, ids []string) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetMany(ctx, ids) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9478,11 +9494,11 @@ func (s *TimerLayerUserStore) GetMany(ctx context.Context, ids []string) ([]*mod } func (s *TimerLayerUserStore) GetNewUsersForTeam(teamID string, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetNewUsersForTeam(teamID, offset, limit, viewRestrictions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9494,11 +9510,11 @@ func (s *TimerLayerUserStore) GetNewUsersForTeam(teamID string, offset int, limi } func (s *TimerLayerUserStore) GetProfileByGroupChannelIdsForUser(userID string, channelIds []string) (map[string][]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetProfileByGroupChannelIdsForUser(userID, channelIds) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9510,11 +9526,11 @@ func (s *TimerLayerUserStore) GetProfileByGroupChannelIdsForUser(userID string, } func (s *TimerLayerUserStore) GetProfileByIds(ctx context.Context, userIds []string, options *store.UserGetByIdsOpts, allowFromCache bool) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetProfileByIds(ctx, userIds, options, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9526,11 +9542,11 @@ func (s *TimerLayerUserStore) GetProfileByIds(ctx context.Context, userIds []str } func (s *TimerLayerUserStore) GetProfiles(options *model.UserGetOptions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetProfiles(options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9542,11 +9558,11 @@ func (s *TimerLayerUserStore) GetProfiles(options *model.UserGetOptions) ([]*mod } func (s *TimerLayerUserStore) GetProfilesByUsernames(usernames []string, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetProfilesByUsernames(usernames, viewRestrictions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9558,11 +9574,11 @@ func (s *TimerLayerUserStore) GetProfilesByUsernames(usernames []string, viewRes } func (s *TimerLayerUserStore) GetProfilesInChannel(options *model.UserGetOptions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetProfilesInChannel(options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9574,11 +9590,11 @@ func (s *TimerLayerUserStore) GetProfilesInChannel(options *model.UserGetOptions } func (s *TimerLayerUserStore) GetProfilesInChannelByStatus(options *model.UserGetOptions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetProfilesInChannelByStatus(options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9590,11 +9606,11 @@ func (s *TimerLayerUserStore) GetProfilesInChannelByStatus(options *model.UserGe } func (s *TimerLayerUserStore) GetProfilesNotInChannel(teamID string, channelId string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetProfilesNotInChannel(teamID, channelId, groupConstrained, offset, limit, viewRestrictions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9606,11 +9622,11 @@ func (s *TimerLayerUserStore) GetProfilesNotInChannel(teamID string, channelId s } func (s *TimerLayerUserStore) GetProfilesNotInTeam(teamID string, groupConstrained bool, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetProfilesNotInTeam(teamID, groupConstrained, offset, limit, viewRestrictions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9622,11 +9638,11 @@ func (s *TimerLayerUserStore) GetProfilesNotInTeam(teamID string, groupConstrain } func (s *TimerLayerUserStore) GetProfilesWithoutTeam(options *model.UserGetOptions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetProfilesWithoutTeam(options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9638,11 +9654,11 @@ func (s *TimerLayerUserStore) GetProfilesWithoutTeam(options *model.UserGetOptio } func (s *TimerLayerUserStore) GetRecentlyActiveUsersForTeam(teamID string, offset int, limit int, viewRestrictions *model.ViewUsersRestrictions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetRecentlyActiveUsersForTeam(teamID, offset, limit, viewRestrictions) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9654,11 +9670,11 @@ func (s *TimerLayerUserStore) GetRecentlyActiveUsersForTeam(teamID string, offse } func (s *TimerLayerUserStore) GetSystemAdminProfiles() (map[string]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetSystemAdminProfiles() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9670,11 +9686,11 @@ func (s *TimerLayerUserStore) GetSystemAdminProfiles() (map[string]*model.User, } func (s *TimerLayerUserStore) GetTeamGroupUsers(teamID string) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetTeamGroupUsers(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9686,11 +9702,11 @@ func (s *TimerLayerUserStore) GetTeamGroupUsers(teamID string) ([]*model.User, e } func (s *TimerLayerUserStore) GetUnreadCount(userID string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetUnreadCount(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9702,11 +9718,11 @@ func (s *TimerLayerUserStore) GetUnreadCount(userID string) (int64, error) { } func (s *TimerLayerUserStore) GetUnreadCountForChannel(userID string, channelID string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetUnreadCountForChannel(userID, channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9718,11 +9734,11 @@ func (s *TimerLayerUserStore) GetUnreadCountForChannel(userID string, channelID } func (s *TimerLayerUserStore) GetUsersBatchForIndexing(startTime int64, startFileID string, limit int) ([]*model.UserForIndexing, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetUsersBatchForIndexing(startTime, startFileID, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9734,11 +9750,11 @@ func (s *TimerLayerUserStore) GetUsersBatchForIndexing(startTime int64, startFil } func (s *TimerLayerUserStore) GetUsersWithInvalidEmails(page int, perPage int, restrictedDomains string) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.GetUsersWithInvalidEmails(page, perPage, restrictedDomains) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9750,11 +9766,11 @@ func (s *TimerLayerUserStore) GetUsersWithInvalidEmails(page int, perPage int, r } func (s *TimerLayerUserStore) InferSystemInstallDate() (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.InferSystemInstallDate() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9766,11 +9782,11 @@ func (s *TimerLayerUserStore) InferSystemInstallDate() (int64, error) { } func (s *TimerLayerUserStore) InsertUsers(users []*model.User) error { - start := timemodule.Now() + start := time.Now() err := s.UserStore.InsertUsers(users) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9782,11 +9798,11 @@ func (s *TimerLayerUserStore) InsertUsers(users []*model.User) error { } func (s *TimerLayerUserStore) InvalidateProfileCacheForUser(userID string) { - start := timemodule.Now() + start := time.Now() s.UserStore.InvalidateProfileCacheForUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -9797,11 +9813,11 @@ func (s *TimerLayerUserStore) InvalidateProfileCacheForUser(userID string) { } func (s *TimerLayerUserStore) InvalidateProfilesInChannelCache(channelID string) { - start := timemodule.Now() + start := time.Now() s.UserStore.InvalidateProfilesInChannelCache(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -9812,11 +9828,11 @@ func (s *TimerLayerUserStore) InvalidateProfilesInChannelCache(channelID string) } func (s *TimerLayerUserStore) InvalidateProfilesInChannelCacheByUser(userID string) { - start := timemodule.Now() + start := time.Now() s.UserStore.InvalidateProfilesInChannelCacheByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -9827,11 +9843,11 @@ func (s *TimerLayerUserStore) InvalidateProfilesInChannelCacheByUser(userID stri } func (s *TimerLayerUserStore) IsEmpty(excludeBots bool) (bool, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.IsEmpty(excludeBots) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9843,11 +9859,11 @@ func (s *TimerLayerUserStore) IsEmpty(excludeBots bool) (bool, error) { } func (s *TimerLayerUserStore) PermanentDelete(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.UserStore.PermanentDelete(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9859,11 +9875,11 @@ func (s *TimerLayerUserStore) PermanentDelete(userID string) error { } func (s *TimerLayerUserStore) PromoteGuestToUser(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.UserStore.PromoteGuestToUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9875,11 +9891,11 @@ func (s *TimerLayerUserStore) PromoteGuestToUser(userID string) error { } func (s *TimerLayerUserStore) ResetAuthDataToEmailForUsers(service string, userIDs []string, includeDeleted bool, dryRun bool) (int, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.ResetAuthDataToEmailForUsers(service, userIDs, includeDeleted, dryRun) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9891,11 +9907,11 @@ func (s *TimerLayerUserStore) ResetAuthDataToEmailForUsers(service string, userI } func (s *TimerLayerUserStore) ResetLastPictureUpdate(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.UserStore.ResetLastPictureUpdate(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9907,11 +9923,11 @@ func (s *TimerLayerUserStore) ResetLastPictureUpdate(userID string) error { } func (s *TimerLayerUserStore) Save(user *model.User) (*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.Save(user) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9923,11 +9939,11 @@ func (s *TimerLayerUserStore) Save(user *model.User) (*model.User, error) { } func (s *TimerLayerUserStore) Search(teamID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.Search(teamID, term, options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9939,11 +9955,11 @@ func (s *TimerLayerUserStore) Search(teamID string, term string, options *model. } func (s *TimerLayerUserStore) SearchInChannel(channelID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.SearchInChannel(channelID, term, options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9955,11 +9971,11 @@ func (s *TimerLayerUserStore) SearchInChannel(channelID string, term string, opt } func (s *TimerLayerUserStore) SearchInGroup(groupID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.SearchInGroup(groupID, term, options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9971,11 +9987,11 @@ func (s *TimerLayerUserStore) SearchInGroup(groupID string, term string, options } func (s *TimerLayerUserStore) SearchNotInChannel(teamID string, channelID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.SearchNotInChannel(teamID, channelID, term, options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -9987,11 +10003,11 @@ func (s *TimerLayerUserStore) SearchNotInChannel(teamID string, channelID string } func (s *TimerLayerUserStore) SearchNotInGroup(groupID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.SearchNotInGroup(groupID, term, options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10003,11 +10019,11 @@ func (s *TimerLayerUserStore) SearchNotInGroup(groupID string, term string, opti } func (s *TimerLayerUserStore) SearchNotInTeam(notInTeamID string, term string, options *model.UserSearchOptions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.SearchNotInTeam(notInTeamID, term, options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10019,11 +10035,11 @@ func (s *TimerLayerUserStore) SearchNotInTeam(notInTeamID string, term string, o } func (s *TimerLayerUserStore) SearchWithoutTeam(term string, options *model.UserSearchOptions) ([]*model.User, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.SearchWithoutTeam(term, options) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10035,11 +10051,11 @@ func (s *TimerLayerUserStore) SearchWithoutTeam(term string, options *model.User } func (s *TimerLayerUserStore) Update(user *model.User, allowRoleUpdate bool) (*model.UserUpdate, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.Update(user, allowRoleUpdate) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10051,11 +10067,11 @@ func (s *TimerLayerUserStore) Update(user *model.User, allowRoleUpdate bool) (*m } func (s *TimerLayerUserStore) UpdateAuthData(userID string, service string, authData *string, email string, resetMfa bool) (string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.UpdateAuthData(userID, service, authData, email, resetMfa) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10067,11 +10083,11 @@ func (s *TimerLayerUserStore) UpdateAuthData(userID string, service string, auth } func (s *TimerLayerUserStore) UpdateFailedPasswordAttempts(userID string, attempts int) error { - start := timemodule.Now() + start := time.Now() err := s.UserStore.UpdateFailedPasswordAttempts(userID, attempts) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10083,11 +10099,11 @@ func (s *TimerLayerUserStore) UpdateFailedPasswordAttempts(userID string, attemp } func (s *TimerLayerUserStore) UpdateLastPictureUpdate(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.UserStore.UpdateLastPictureUpdate(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10099,11 +10115,11 @@ func (s *TimerLayerUserStore) UpdateLastPictureUpdate(userID string) error { } func (s *TimerLayerUserStore) UpdateMfaActive(userID string, active bool) error { - start := timemodule.Now() + start := time.Now() err := s.UserStore.UpdateMfaActive(userID, active) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10115,11 +10131,11 @@ func (s *TimerLayerUserStore) UpdateMfaActive(userID string, active bool) error } func (s *TimerLayerUserStore) UpdateMfaSecret(userID string, secret string) error { - start := timemodule.Now() + start := time.Now() err := s.UserStore.UpdateMfaSecret(userID, secret) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10131,11 +10147,11 @@ func (s *TimerLayerUserStore) UpdateMfaSecret(userID string, secret string) erro } func (s *TimerLayerUserStore) UpdateNotifyProps(userID string, props map[string]string) error { - start := timemodule.Now() + start := time.Now() err := s.UserStore.UpdateNotifyProps(userID, props) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10147,11 +10163,11 @@ func (s *TimerLayerUserStore) UpdateNotifyProps(userID string, props map[string] } func (s *TimerLayerUserStore) UpdatePassword(userID string, newPassword string) error { - start := timemodule.Now() + start := time.Now() err := s.UserStore.UpdatePassword(userID, newPassword) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10163,11 +10179,11 @@ func (s *TimerLayerUserStore) UpdatePassword(userID string, newPassword string) } func (s *TimerLayerUserStore) UpdateUpdateAt(userID string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.UpdateUpdateAt(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10179,11 +10195,11 @@ func (s *TimerLayerUserStore) UpdateUpdateAt(userID string) (int64, error) { } func (s *TimerLayerUserStore) VerifyEmail(userID string, email string) (string, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserStore.VerifyEmail(userID, email) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10195,11 +10211,11 @@ func (s *TimerLayerUserStore) VerifyEmail(userID string, email string) (string, } func (s *TimerLayerUserAccessTokenStore) Delete(tokenID string) error { - start := timemodule.Now() + start := time.Now() err := s.UserAccessTokenStore.Delete(tokenID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10211,11 +10227,11 @@ func (s *TimerLayerUserAccessTokenStore) Delete(tokenID string) error { } func (s *TimerLayerUserAccessTokenStore) DeleteAllForUser(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.UserAccessTokenStore.DeleteAllForUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10227,11 +10243,11 @@ func (s *TimerLayerUserAccessTokenStore) DeleteAllForUser(userID string) error { } func (s *TimerLayerUserAccessTokenStore) Get(tokenID string) (*model.UserAccessToken, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserAccessTokenStore.Get(tokenID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10243,11 +10259,11 @@ func (s *TimerLayerUserAccessTokenStore) Get(tokenID string) (*model.UserAccessT } func (s *TimerLayerUserAccessTokenStore) GetAll(offset int, limit int) ([]*model.UserAccessToken, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserAccessTokenStore.GetAll(offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10259,11 +10275,11 @@ func (s *TimerLayerUserAccessTokenStore) GetAll(offset int, limit int) ([]*model } func (s *TimerLayerUserAccessTokenStore) GetByToken(tokenString string) (*model.UserAccessToken, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserAccessTokenStore.GetByToken(tokenString) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10275,11 +10291,11 @@ func (s *TimerLayerUserAccessTokenStore) GetByToken(tokenString string) (*model. } func (s *TimerLayerUserAccessTokenStore) GetByUser(userID string, page int, perPage int) ([]*model.UserAccessToken, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserAccessTokenStore.GetByUser(userID, page, perPage) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10291,11 +10307,11 @@ func (s *TimerLayerUserAccessTokenStore) GetByUser(userID string, page int, perP } func (s *TimerLayerUserAccessTokenStore) Save(token *model.UserAccessToken) (*model.UserAccessToken, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserAccessTokenStore.Save(token) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10307,11 +10323,11 @@ func (s *TimerLayerUserAccessTokenStore) Save(token *model.UserAccessToken) (*mo } func (s *TimerLayerUserAccessTokenStore) Search(term string) ([]*model.UserAccessToken, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserAccessTokenStore.Search(term) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10323,11 +10339,11 @@ func (s *TimerLayerUserAccessTokenStore) Search(term string) ([]*model.UserAcces } func (s *TimerLayerUserAccessTokenStore) UpdateTokenDisable(tokenID string) error { - start := timemodule.Now() + start := time.Now() err := s.UserAccessTokenStore.UpdateTokenDisable(tokenID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10339,11 +10355,11 @@ func (s *TimerLayerUserAccessTokenStore) UpdateTokenDisable(tokenID string) erro } func (s *TimerLayerUserAccessTokenStore) UpdateTokenEnable(tokenID string) error { - start := timemodule.Now() + start := time.Now() err := s.UserAccessTokenStore.UpdateTokenEnable(tokenID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10355,11 +10371,11 @@ func (s *TimerLayerUserAccessTokenStore) UpdateTokenEnable(tokenID string) error } func (s *TimerLayerUserTermsOfServiceStore) Delete(userID string, termsOfServiceId string) error { - start := timemodule.Now() + start := time.Now() err := s.UserTermsOfServiceStore.Delete(userID, termsOfServiceId) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10371,11 +10387,11 @@ func (s *TimerLayerUserTermsOfServiceStore) Delete(userID string, termsOfService } func (s *TimerLayerUserTermsOfServiceStore) GetByUser(userID string) (*model.UserTermsOfService, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserTermsOfServiceStore.GetByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10387,11 +10403,11 @@ func (s *TimerLayerUserTermsOfServiceStore) GetByUser(userID string) (*model.Use } func (s *TimerLayerUserTermsOfServiceStore) Save(userTermsOfService *model.UserTermsOfService) (*model.UserTermsOfService, error) { - start := timemodule.Now() + start := time.Now() result, err := s.UserTermsOfServiceStore.Save(userTermsOfService) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10403,11 +10419,11 @@ func (s *TimerLayerUserTermsOfServiceStore) Save(userTermsOfService *model.UserT } func (s *TimerLayerWebhookStore) AnalyticsIncomingCount(teamID string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.AnalyticsIncomingCount(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10419,11 +10435,11 @@ func (s *TimerLayerWebhookStore) AnalyticsIncomingCount(teamID string) (int64, e } func (s *TimerLayerWebhookStore) AnalyticsOutgoingCount(teamID string) (int64, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.AnalyticsOutgoingCount(teamID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10435,11 +10451,11 @@ func (s *TimerLayerWebhookStore) AnalyticsOutgoingCount(teamID string) (int64, e } func (s *TimerLayerWebhookStore) ClearCaches() { - start := timemodule.Now() + start := time.Now() s.WebhookStore.ClearCaches() - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -10449,12 +10465,12 @@ func (s *TimerLayerWebhookStore) ClearCaches() { } } -func (s *TimerLayerWebhookStore) DeleteIncoming(webhookID string, time int64) error { - start := timemodule.Now() +func (s *TimerLayerWebhookStore) DeleteIncoming(webhookID string, timestamp int64) error { + start := time.Now() - err := s.WebhookStore.DeleteIncoming(webhookID, time) + err := s.WebhookStore.DeleteIncoming(webhookID, timestamp) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10465,12 +10481,12 @@ func (s *TimerLayerWebhookStore) DeleteIncoming(webhookID string, time int64) er return err } -func (s *TimerLayerWebhookStore) DeleteOutgoing(webhookID string, time int64) error { - start := timemodule.Now() +func (s *TimerLayerWebhookStore) DeleteOutgoing(webhookID string, timestamp int64) error { + start := time.Now() - err := s.WebhookStore.DeleteOutgoing(webhookID, time) + err := s.WebhookStore.DeleteOutgoing(webhookID, timestamp) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10482,11 +10498,11 @@ func (s *TimerLayerWebhookStore) DeleteOutgoing(webhookID string, time int64) er } func (s *TimerLayerWebhookStore) GetIncoming(id string, allowFromCache bool) (*model.IncomingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.GetIncoming(id, allowFromCache) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10498,11 +10514,11 @@ func (s *TimerLayerWebhookStore) GetIncoming(id string, allowFromCache bool) (*m } func (s *TimerLayerWebhookStore) GetIncomingByChannel(channelID string) ([]*model.IncomingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.GetIncomingByChannel(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10514,11 +10530,11 @@ func (s *TimerLayerWebhookStore) GetIncomingByChannel(channelID string) ([]*mode } func (s *TimerLayerWebhookStore) GetIncomingByTeam(teamID string, offset int, limit int) ([]*model.IncomingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.GetIncomingByTeam(teamID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10530,11 +10546,11 @@ func (s *TimerLayerWebhookStore) GetIncomingByTeam(teamID string, offset int, li } func (s *TimerLayerWebhookStore) GetIncomingByTeamByUser(teamID string, userID string, offset int, limit int) ([]*model.IncomingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.GetIncomingByTeamByUser(teamID, userID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10546,11 +10562,11 @@ func (s *TimerLayerWebhookStore) GetIncomingByTeamByUser(teamID string, userID s } func (s *TimerLayerWebhookStore) GetIncomingList(offset int, limit int) ([]*model.IncomingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.GetIncomingList(offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10562,11 +10578,11 @@ func (s *TimerLayerWebhookStore) GetIncomingList(offset int, limit int) ([]*mode } func (s *TimerLayerWebhookStore) GetIncomingListByUser(userID string, offset int, limit int) ([]*model.IncomingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.GetIncomingListByUser(userID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10578,11 +10594,11 @@ func (s *TimerLayerWebhookStore) GetIncomingListByUser(userID string, offset int } func (s *TimerLayerWebhookStore) GetOutgoing(id string) (*model.OutgoingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.GetOutgoing(id) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10594,11 +10610,11 @@ func (s *TimerLayerWebhookStore) GetOutgoing(id string) (*model.OutgoingWebhook, } func (s *TimerLayerWebhookStore) GetOutgoingByChannel(channelID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.GetOutgoingByChannel(channelID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10610,11 +10626,11 @@ func (s *TimerLayerWebhookStore) GetOutgoingByChannel(channelID string, offset i } func (s *TimerLayerWebhookStore) GetOutgoingByChannelByUser(channelID string, userID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.GetOutgoingByChannelByUser(channelID, userID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10626,11 +10642,11 @@ func (s *TimerLayerWebhookStore) GetOutgoingByChannelByUser(channelID string, us } func (s *TimerLayerWebhookStore) GetOutgoingByTeam(teamID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.GetOutgoingByTeam(teamID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10642,11 +10658,11 @@ func (s *TimerLayerWebhookStore) GetOutgoingByTeam(teamID string, offset int, li } func (s *TimerLayerWebhookStore) GetOutgoingByTeamByUser(teamID string, userID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.GetOutgoingByTeamByUser(teamID, userID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10658,11 +10674,11 @@ func (s *TimerLayerWebhookStore) GetOutgoingByTeamByUser(teamID string, userID s } func (s *TimerLayerWebhookStore) GetOutgoingList(offset int, limit int) ([]*model.OutgoingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.GetOutgoingList(offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10674,11 +10690,11 @@ func (s *TimerLayerWebhookStore) GetOutgoingList(offset int, limit int) ([]*mode } func (s *TimerLayerWebhookStore) GetOutgoingListByUser(userID string, offset int, limit int) ([]*model.OutgoingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.GetOutgoingListByUser(userID, offset, limit) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10690,11 +10706,11 @@ func (s *TimerLayerWebhookStore) GetOutgoingListByUser(userID string, offset int } func (s *TimerLayerWebhookStore) InvalidateWebhookCache(webhook string) { - start := timemodule.Now() + start := time.Now() s.WebhookStore.InvalidateWebhookCache(webhook) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if true { @@ -10705,11 +10721,11 @@ func (s *TimerLayerWebhookStore) InvalidateWebhookCache(webhook string) { } func (s *TimerLayerWebhookStore) PermanentDeleteIncomingByChannel(channelID string) error { - start := timemodule.Now() + start := time.Now() err := s.WebhookStore.PermanentDeleteIncomingByChannel(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10721,11 +10737,11 @@ func (s *TimerLayerWebhookStore) PermanentDeleteIncomingByChannel(channelID stri } func (s *TimerLayerWebhookStore) PermanentDeleteIncomingByUser(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.WebhookStore.PermanentDeleteIncomingByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10737,11 +10753,11 @@ func (s *TimerLayerWebhookStore) PermanentDeleteIncomingByUser(userID string) er } func (s *TimerLayerWebhookStore) PermanentDeleteOutgoingByChannel(channelID string) error { - start := timemodule.Now() + start := time.Now() err := s.WebhookStore.PermanentDeleteOutgoingByChannel(channelID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10753,11 +10769,11 @@ func (s *TimerLayerWebhookStore) PermanentDeleteOutgoingByChannel(channelID stri } func (s *TimerLayerWebhookStore) PermanentDeleteOutgoingByUser(userID string) error { - start := timemodule.Now() + start := time.Now() err := s.WebhookStore.PermanentDeleteOutgoingByUser(userID) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10769,11 +10785,11 @@ func (s *TimerLayerWebhookStore) PermanentDeleteOutgoingByUser(userID string) er } func (s *TimerLayerWebhookStore) SaveIncoming(webhook *model.IncomingWebhook) (*model.IncomingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.SaveIncoming(webhook) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10785,11 +10801,11 @@ func (s *TimerLayerWebhookStore) SaveIncoming(webhook *model.IncomingWebhook) (* } func (s *TimerLayerWebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) (*model.OutgoingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.SaveOutgoing(webhook) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10801,11 +10817,11 @@ func (s *TimerLayerWebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) (* } func (s *TimerLayerWebhookStore) UpdateIncoming(webhook *model.IncomingWebhook) (*model.IncomingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.UpdateIncoming(webhook) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil { @@ -10817,11 +10833,11 @@ func (s *TimerLayerWebhookStore) UpdateIncoming(webhook *model.IncomingWebhook) } func (s *TimerLayerWebhookStore) UpdateOutgoing(hook *model.OutgoingWebhook) (*model.OutgoingWebhook, error) { - start := timemodule.Now() + start := time.Now() result, err := s.WebhookStore.UpdateOutgoing(hook) - elapsed := float64(timemodule.Since(start)) / float64(timemodule.Second) + elapsed := float64(time.Since(start)) / float64(time.Second) if s.Root.Metrics != nil { success := "false" if err == nil {