mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-02-21 02:01:35 +00:00
Avoid creating duplicate entries in the image table
This commit is contained in:
parent
1d16941a2d
commit
0b4f50d207
@ -185,7 +185,9 @@ do ->
|
||||
else
|
||||
repoTag = buildRepoTag(repo, tag, registry)
|
||||
Promise.using writeLockImages(), ->
|
||||
knex('image').insert({ repoTag })
|
||||
knex('image').select().where({ repoTag })
|
||||
.then ([ img ]) ->
|
||||
knex('image').insert({ repoTag }) if !img?
|
||||
.then ->
|
||||
if fromImage?
|
||||
docker.createImageAsync({ fromImage, tag })
|
||||
@ -199,7 +201,9 @@ do ->
|
||||
exports.pullAndProtectImage = (image, onProgress) ->
|
||||
repoTag = buildRepoTag(image)
|
||||
Promise.using writeLockImages(), ->
|
||||
knex('image').insert({ repoTag })
|
||||
knex('image').select().where({ repoTag })
|
||||
.then ([ img ]) ->
|
||||
knex('image').insert({ repoTag }) if !img?
|
||||
.then ->
|
||||
dockerProgress.pull(repoTag, onProgress)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user