Skip to content

Commit

Permalink
fix: logging in reconciliation
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Mar 6, 2024
1 parent 4fb834c commit 9d90b0e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions upstream/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,20 @@ func reconcileTable(ctx context.Context, config UpstreamConfig, table pushableTa
return count, nil
}

ctx.Tracef("pushing %s %d to upstream", table, len(items))
ctx.Tracef("pushing %s %d to upstream", table.TableName(), len(items))
if err := client.Push(ctx, NewPushData(items)); err != nil {
return 0, fmt.Errorf("failed to push %s to upstream: %w", table, err)
return 0, fmt.Errorf("failed to push %s to upstream: %w", table.TableName(), err)
}
count += len(items)

if c, ok := table.(customIsPushedUpdater); ok {
if err := c.UpdateIsPushed(ctx.DB(), items); err != nil {
return 0, fmt.Errorf("failed to update is_pushed for %s: %w", table, err)
return 0, fmt.Errorf("failed to update is_pushed for %s: %w", table.TableName(), err)
}
} else {
ids := lo.Map(items, func(a models.DBTable, _ int) string { return a.PK() })
if err := ctx.DB().Model(table).Where("id IN ?", ids).Update("is_pushed", true).Error; err != nil {
return 0, fmt.Errorf("failed to update is_pushed on %s: %w", table, err)
return 0, fmt.Errorf("failed to update is_pushed on %s: %w", table.TableName(), err)
}
}
}
Expand Down

0 comments on commit 9d90b0e

Please sign in to comment.