Skip to content

Commit

Permalink
fix datapasta_clone leakage
Browse files Browse the repository at this point in the history
  • Loading branch information
bessiambre committed Jun 19, 2023
1 parent 310cccc commit c37171d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ func (db pgbatchtx) Insert(fkm ForeignKeyMapper, rows ...map[string]any) error {
return err
}

//clear out the temp table of any rows in case db connection is pooled and reused.
if _, err := db.tx.db.Exec(db.ctx, "TRUNCATE datapasta_clone"); err != nil {
return err
}

start := time.Now()

batch := &pgx.Batch{}
Expand Down

0 comments on commit c37171d

Please sign in to comment.