diff --git a/src/features/ci-cd/hooks/service-installs.ts b/src/features/ci-cd/hooks/service-installs.ts index 4a4b57848..27f4a1d8d 100644 --- a/src/features/ci-cd/hooks/service-installs.ts +++ b/src/features/ci-cd/hooks/service-installs.ts @@ -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