Skip to content

Commit f0cad91

Browse files
committed
store webhook event
1 parent 9a96d2c commit f0cad91

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

internal/repository/webhook_event_postgres.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ func (r *webhookEventRepository) StoreEvents(ctx context.Context, workspaceID st
6060
now := time.Now()
6161

6262
// Batch size limit to avoid hitting Postgres parameter limits (max 65535 parameters)
63-
const batchSize = 1000 // Each event uses 13 parameters, so ~4000 events would hit the limit
63+
const batchSize = 1000 // Each event uses 13 parameters, so ~5000 events would hit the limit
6464

6565
// Process in batches
6666
for i := 0; i < len(events); i += batchSize {
@@ -70,11 +70,11 @@ func (r *webhookEventRepository) StoreEvents(ctx context.Context, workspaceID st
7070
}
7171

7272
currentBatch := events[i:end]
73-
args := make([]interface{}, 0, len(currentBatch)*15)
73+
args := make([]interface{}, 0, len(currentBatch)*13)
7474

7575
// Generate placeholders and collect args for this batch
7676
for j, event := range currentBatch {
77-
paramOffset := j * 15
77+
paramOffset := j * 13
7878
placeholders[j] = fmt.Sprintf("($%d,$%d,$%d,$%d,$%d,$%d,$%d,$%d,$%d,$%d,$%d,$%d,$%d)",
7979
paramOffset+1, paramOffset+2, paramOffset+3, paramOffset+4, paramOffset+5,
8080
paramOffset+6, paramOffset+7, paramOffset+8, paramOffset+9, paramOffset+10,

0 commit comments

Comments
 (0)