mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-22 03:37:43 +00:00
same timezone everywhere
This commit is contained in:
parent
11ccf632c3
commit
c9877879da
4 changed files with 5 additions and 5 deletions
|
@ -30,7 +30,7 @@ func (a *api) createLiveActivityHandler(w http.ResponseWriter, r *http.Request)
|
||||||
}
|
}
|
||||||
|
|
||||||
la.RefreshToken = rtr.RefreshToken
|
la.RefreshToken = rtr.RefreshToken
|
||||||
la.TokenExpiresAt = time.Now().Add(1 * time.Hour).UTC()
|
la.TokenExpiresAt = time.Now().Add(1 * time.Hour)
|
||||||
|
|
||||||
if err := a.liveActivityRepo.Create(ctx, la); err != nil {
|
if err := a.liveActivityRepo.Create(ctx, la); err != nil {
|
||||||
a.errorResponse(w, r, 500, err)
|
a.errorResponse(w, r, 500, err)
|
||||||
|
|
|
@ -149,7 +149,7 @@ func enqueueLiveActivities(ctx context.Context, logger *zap.Logger, pool *pgxpoo
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
now := time.Now().UTC()
|
now := time.Now()
|
||||||
next := now.Add(domain.LiveActivityCheckInterval)
|
next := now.Add(domain.LiveActivityCheckInterval)
|
||||||
|
|
||||||
stmt := `UPDATE live_activities
|
stmt := `UPDATE live_activities
|
||||||
|
|
|
@ -87,8 +87,8 @@ func (p *postgresLiveActivityRepository) Create(ctx context.Context, la *domain.
|
||||||
la.TokenExpiresAt,
|
la.TokenExpiresAt,
|
||||||
la.ThreadID,
|
la.ThreadID,
|
||||||
la.Subreddit,
|
la.Subreddit,
|
||||||
time.Now().UTC(),
|
time.Now(),
|
||||||
time.Now().Add(domain.LiveActivityDuration).UTC(),
|
time.Now().Add(domain.LiveActivityDuration),
|
||||||
).Scan(&la.ID)
|
).Scan(&la.ID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ func (lac *liveActivitiesConsumer) Consume(delivery rmq.Delivery) {
|
||||||
ctx, cancel := context.WithCancel(lac)
|
ctx, cancel := context.WithCancel(lac)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
now := time.Now().UTC()
|
now := time.Now()
|
||||||
defer func() {
|
defer func() {
|
||||||
elapsed := time.Now().Sub(now).Milliseconds()
|
elapsed := time.Now().Sub(now).Milliseconds()
|
||||||
_ = lac.statsd.Histogram("apollo.consumer.runtime", float64(elapsed), []string{"queue:live_activities"}, 0.1)
|
_ = lac.statsd.Histogram("apollo.consumer.runtime", float64(elapsed), []string{"queue:live_activities"}, 0.1)
|
||||||
|
|
Loading…
Reference in a new issue