Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DAEMON=
RUN_FREQUENCY=
EXECUTION_TIMEOUT=
SENTRY_DSN=
JSON_LOGS=
LOG_LEVEL=
DISCORD_APPLICATION_ID=
DISCORD_TOKEN=
DISCORD_PROXY_HOST=
DATABASE_URI=
MAX_REMOVALS_THRESHOLD=
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module github.com/TicketsBot-cloud/discord-entitlements-db-sync

go 1.22.0

replace github.com/TicketsBot-cloud/gdl => ../gdl

require (
github.com/TicketsBot-cloud/common v0.0.0-20251026182733-99fa0dc31d90
github.com/TicketsBot-cloud/database v0.0.0-20251230153828-3a49abf50812
Expand Down
8 changes: 4 additions & 4 deletions internal/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (d *Daemon) RunOnce(ctx context.Context) error {

start := time.Now()
defer func() {
duration := time.Now().Sub(start)
duration := time.Since(start)
if duration > (d.config.ExecutionTimeout / 2.0) {
d.logger.Warn("Execution took more than 50% of the timeout", zap.Duration("duration", duration))
}
Expand Down Expand Up @@ -202,9 +202,9 @@ func (d *Daemon) nextPage(ctx context.Context, afterId uint64, entitlements []en
d.logger.Debug("Fetching page of entitlements", zap.Uint64("after", afterId), zap.Int("limit", pageLimit), zap.Int("total", len(entitlements)))

fetched, err := rest.ListEntitlements(ctx, d.config.Discord.Token, nil, d.config.Discord.ApplicationId, rest.EntitlementQueryOptions{
After: utils.Ptr(afterId),
Limit: utils.Ptr(pageLimit),
ExcludedEnded: utils.Ptr(true),
After: utils.Ptr(afterId),
Limit: utils.Ptr(pageLimit),
ExcludeEnded: utils.Ptr(true),
})
if err != nil {
return nil, err
Expand Down
Loading