only check unprocessed events from last 1 day
Some checks are pending
CI / Test (push) Waiting to run
CI / End-to-End (push) Waiting to run
CI / Publish Docker (push) Blocked by required conditions
CI / Lint (push) Waiting to run
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-25 12:55:13 +10:00
parent 47bc8acace
commit c7c890f6bb
3 changed files with 8 additions and 4 deletions

View File

@@ -50,6 +50,7 @@ ORDER BY "EventTime";
-- name: ListUnprocessedEvents :many
SELECT * FROM "Events"
WHERE "Processed" = 0
AND "EventTime" > sqlc.arg('eventTime')
ORDER BY "EventTime";
-- name: UpdateEventsProcessed :exec

View File

@@ -422,11 +422,12 @@ func (q *Queries) ListInventory(ctx context.Context) ([]Inventory, error) {
const listUnprocessedEvents = `-- name: ListUnprocessedEvents :many
SELECT Eid, CloudId, Source, EventTime, ChainId, VmId, EventKey, DatacenterName, ComputeResourceName, UserName, Processed, DatacenterId, ComputeResourceId, VmName, EventType FROM "Events"
WHERE "Processed" = 0
AND "EventTime" > ?1
ORDER BY "EventTime"
`
func (q *Queries) ListUnprocessedEvents(ctx context.Context) ([]Events, error) {
rows, err := q.db.QueryContext(ctx, listUnprocessedEvents)
func (q *Queries) ListUnprocessedEvents(ctx context.Context, eventtime sql.NullInt64) ([]Events, error) {
rows, err := q.db.QueryContext(ctx, listUnprocessedEvents, eventtime)
if err != nil {
return nil, err
}