Skip to content

Commit

Permalink
database: ignore insertLayer collisions to make it truly idempotent
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin-M authored and jzelinskie committed Feb 24, 2016
1 parent d19a434 commit d3b1410
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions database/pgsql/layer.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,11 @@ func (pgSQL *pgSQL) InsertLayer(layer database.Layer) error {
Scan(&layer.ID)
if err != nil {
tx.Rollback()

if isErrUniqueViolation(err) {
// Ignore this error, another process collided.
return nil
}
return handleError("i_layer", err)
}
} else {
Expand Down

0 comments on commit d3b1410

Please sign in to comment.