Merge pull request #12 from christianselig/chore/make-render-friendly

Fixes for Render
This commit is contained in:
André Medeiros 2021-07-22 20:24:27 -04:00 committed by GitHub
commit 254ed001b6
4 changed files with 9 additions and 11 deletions

View file

@ -32,7 +32,7 @@ func APICmd(ctx context.Context) *cobra.Command {
} }
defer statsd.Close() defer statsd.Close()
db, err := cmdutil.NewDatabasePool(ctx, 32) db, err := cmdutil.NewDatabasePool(ctx, 1)
if err != nil { if err != nil {
return err return err
} }

View file

@ -141,10 +141,12 @@ func cleanAccounts(ctx context.Context, logger *logrus.Logger, pool *pgxpool.Poo
return return
} }
if count > 0 {
logger.WithFields(logrus.Fields{ logger.WithFields(logrus.Fields{
"count": count, "count": count,
}).Info("cleaned stale accounts") }).Info("cleaned stale accounts")
} }
}
func cleanQueues(ctx context.Context, logger *logrus.Logger, jobsConn rmq.Connection) { func cleanQueues(ctx context.Context, logger *logrus.Logger, jobsConn rmq.Connection) {
cleaner := rmq.NewCleaner(jobsConn) cleaner := rmq.NewCleaner(jobsConn)

View file

@ -32,11 +32,11 @@ func NewStatsdClient(tags ...string) (*statsd.Client, error) {
tags = append(tags, fmt.Sprintf("env:%s", env)) tags = append(tags, fmt.Sprintf("env:%s", env))
} }
return statsd.New("127.0.0.1:8125", statsd.WithTags(tags)) return statsd.New(os.Getenv("STATSD_URL"), statsd.WithTags(tags))
} }
func NewRedisClient(ctx context.Context) (*redis.Client, error) { func NewRedisClient(ctx context.Context) (*redis.Client, error) {
opt, err := redis.ParseURL(os.Getenv("REDISCLOUD_URL")) opt, err := redis.ParseURL(os.Getenv("REDIS_URL"))
if err != nil { if err != nil {
return nil, err return nil, err
} }

View file

@ -38,9 +38,7 @@ func (am *AccountModel) Upsert(a *Account) error {
UPDATE SET UPDATE SET
access_token = $3, access_token = $3,
refresh_token = $4, refresh_token = $4,
expires_at = $5, expires_at = $5
last_message_id = $6,
last_checked_at = $7
RETURNING id` RETURNING id`
return tx.QueryRow( return tx.QueryRow(
am.ctx, am.ctx,
@ -50,8 +48,6 @@ func (am *AccountModel) Upsert(a *Account) error {
a.AccessToken, a.AccessToken,
a.RefreshToken, a.RefreshToken,
a.ExpiresAt, a.ExpiresAt,
a.LastMessageID,
a.LastCheckedAt,
).Scan(&a.ID) ).Scan(&a.ID)
}) })
} }