@balena/open-balena-api 31.2.4 → 31.2.5-build-service-install-mem-b0a7482099c474fd6951abe7d8b60eeeb7298da6-3

Sign up to get free protection for your applications and to get access to all the features.
@@ -83,7 +83,7 @@ const createServiceInstalls = async ({ devices, }) => {
83
83
  console.info('[service-install-task] No service installs to create');
84
84
  return 0;
85
85
  }
86
- const devicesToAddServiceInstalls = await api.resin.get({
86
+ const devicesToAddServiceInstalls = (await api.resin.get({
87
87
  resource: 'device',
88
88
  passthrough: { req: permissions.rootRead },
89
89
  options: {
@@ -105,6 +105,13 @@ const createServiceInstalls = async ({ devices, }) => {
105
105
  }),
106
106
  },
107
107
  },
108
+ })).map((device) => {
109
+ // Transform the device to the simpler object we will need later which is smaller
110
+ // and will allow the larger version to be garbage collected sooner
111
+ return {
112
+ id: device.id,
113
+ serviceInstalls: device.service_install.map((si) => si.installs__service.__id),
114
+ };
108
115
  });
109
116
  // This is already batched at one level, does it make sense to batch it again?
110
117
  const remainingDevices = new Set(devices);
@@ -128,7 +135,7 @@ const createServiceInstalls = async ({ devices, }) => {
128
135
  return totalSiCreated;
129
136
  }
130
137
  // Use existingServiceIds as a Set for faster lookups on the follow up filter
131
- const existingServiceIds = device.service_install.map((si) => si.installs__service.__id);
138
+ const existingServiceIds = device.serviceInstalls;
132
139
  const deviceServiceIds = _.difference(serviceIds, existingServiceIds);
133
140
  await Promise.all(deviceServiceIds.map(async (serviceId) => {
134
141
  // Create a service_install for this pair of service and device
@@ -1 +1 @@
1
- {"version":3,"file":"service-installs.js","sourceRoot":"","sources":["../../../../src/features/ci-cd/tasks/service-installs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,EACN,wBAAwB,EACxB,8CAA8C,GAC9C,MAAM,wBAAwB,CAAC;AAEhC,MAAM,MAAM,GAAG;IACd,IAAI,EAAE,QAAQ;IACd,UAA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BAA+B,EAAE;4BAChC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC;yBACK;wBAC3C,aAAa,EAAE,wBAAwB;qBACvC;iBACD,CAAC,CAAC;gBAEH,OAAO,CAAC,IAAI,CACX,yFAAyF,CACzF,CAAC;gBACF,OAAO,cAAc,CAAC;YACvB,CAAC;YAED,6EAA6E;YAC7E,MAAM,kBAAkB,GAAG,MAAM,CAAC,eAAe,CAAC;YAClD,MAAM,gBAAgB,GAAG,CAAC,CAAC,UAAU,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;YAEtE,MAAM,OAAO,CAAC,GAAG,CAChB,gBAAgB,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE;gBACxC,+DAA+D;gBAC/D,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC;oBACpB,QAAQ,EAAE,iBAAiB;oBAC3B,WAAW,EAAE,EAAE,GAAG,EAAE,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE;oBAC1C,IAAI,EAAE;wBACL,MAAM,EAAE,MAAM,CAAC,EAAE;wBACjB,iBAAiB,EAAE,SAAS;qBAC5B;oBACD,OAAO,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE;iBAClC,CAAC,CAAC;YACJ,CAAC,CAAC,CACF,CAAC;YAEF,cAAc,IAAI,gBAAgB,CAAC,MAAM,CAAC;YAC1C,gBAAgB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,cAAc,CAAC;IACvB,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@balena/open-balena-api",
3
3
  "description": "Internet of things, Made Simple",
4
- "version": "31.2.4",
4
+ "version": "31.2.5-build-service-install-mem-b0a7482099c474fd6951abe7d8b60eeeb7298da6-3",
5
5
  "license": "AGPL-3.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -166,6 +166,6 @@
166
166
  "loader": "ts-node/esm/transpile-only"
167
167
  },
168
168
  "versionist": {
169
- "publishedAt": "2024-11-18T19:07:32.783Z"
169
+ "publishedAt": "2024-11-19T13:44:19.318Z"
170
170
  }
171
171
  }