mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-10 22:17:44 +00:00
Merge pull request #12 from christianselig/chore/make-render-friendly
Fixes for Render
This commit is contained in:
commit
254ed001b6
4 changed files with 9 additions and 11 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -141,9 +141,11 @@ func cleanAccounts(ctx context.Context, logger *logrus.Logger, pool *pgxpool.Poo
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.WithFields(logrus.Fields{
|
if count > 0 {
|
||||||
"count": count,
|
logger.WithFields(logrus.Fields{
|
||||||
}).Info("cleaned stale accounts")
|
"count": count,
|
||||||
|
}).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) {
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue