Skip to content

Commit

Permalink
Service installs: Fix creating two tasks when moving a device
Browse files Browse the repository at this point in the history
Change-type: patch
  • Loading branch information
thgreasi committed Nov 25, 2024
1 parent c84ee72 commit 80bb9ad
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/features/ci-cd/hooks/service-installs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,14 @@ hooks.addPureHook('PATCH', 'resin', 'device', {
}
const newAppId = request.values.belongs_to__application;
if (newAppId != null) {
// We could also have an optimization for the case that `values.is_pinned_on__release != null`
// to make the part that finds the target release faster, but chose to keep this simpler since:
// a) We expect that in the majority of device move requests users will not be also be pinning
// the device at the same time.
// b) Only the sync approach would benefit from it, since creating the service installs via tasks
// (which is going to be the default), only accepts the deviceIds as a parameter,
await createAppServiceInstalls(api, newAppId, affectedIds, tx);
return;
}
if (request.values.is_pinned_on__release !== undefined) {
// If the device was preloaded, and then pinned, service_installs do not exist
Expand Down

0 comments on commit 80bb9ad

Please sign in to comment.