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()
db, err := cmdutil.NewDatabasePool(ctx, 32)
db, err := cmdutil.NewDatabasePool(ctx, 1)
if err != nil {
return err
}

View file

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

View file

@ -32,11 +32,11 @@ func NewStatsdClient(tags ...string) (*statsd.Client, error) {
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) {
opt, err := redis.ParseURL(os.Getenv("REDISCLOUD_URL"))
opt, err := redis.ParseURL(os.Getenv("REDIS_URL"))
if err != nil {
return nil, err
}

View file

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