Skip to content

Commit 773a6e2

Browse files
committed
A couple of fixes
1 parent 2f13ac1 commit 773a6e2

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

apps/webapp/app/platform/zodWorker.server.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,13 @@ export class ZodWorker<TMessageCatalog extends MessageCatalogSchema> {
195195
): Promise<GraphileJob> {
196196
const task = this.#tasks[identifier];
197197

198-
const optionsWithoutTx = omit(options ?? {}, ["tx"]);
198+
const optionsWithoutTx = removeUndefinedKeys(omit(options ?? {}, ["tx"]));
199199
const taskWithoutJobKey = omit(task, ["jobKey"]);
200200

201+
// Make sure options passed in to enqueue take precedence over task options
201202
const spec = {
202-
...optionsWithoutTx,
203203
...taskWithoutJobKey,
204+
...optionsWithoutTx,
204205
};
205206

206207
if (typeof task.queueName === "function") {
@@ -437,3 +438,12 @@ export class ZodWorker<TMessageCatalog extends MessageCatalogSchema> {
437438
logger.debug(`[worker][${this.#name}] ${message}`, args);
438439
}
439440
}
441+
442+
function removeUndefinedKeys<T extends object>(obj: T): T {
443+
for (let key in obj) {
444+
if (Object.prototype.hasOwnProperty.call(obj, key) && obj[key] === undefined) {
445+
delete obj[key];
446+
}
447+
}
448+
return obj;
449+
}

apps/webapp/app/services/endpoints/recurringEndpointIndex.server.ts

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export class RecurringEndpointIndexService {
1919
environment: {
2020
type: RuntimeEnvironmentType.PRODUCTION,
2121
},
22-
2322
indexings: {
2423
none: {
2524
createdAt: {
@@ -28,9 +27,6 @@ export class RecurringEndpointIndexService {
2827
},
2928
},
3029
},
31-
include: {
32-
environment: true,
33-
},
3430
});
3531

3632
logger.debug("Found endpoints that haven't been indexed in the last 10 minutes", {
@@ -39,17 +35,10 @@ export class RecurringEndpointIndexService {
3935

4036
// Enqueue each endpoint for indexing
4137
for (const endpoint of endpoints) {
42-
await workerQueue.enqueue(
43-
"indexEndpoint",
44-
{
45-
id: endpoint.id,
46-
source: "INTERNAL",
47-
},
48-
{
49-
maxAttempts:
50-
endpoint.environment.type === RuntimeEnvironmentType.DEVELOPMENT ? 1 : undefined,
51-
}
52-
);
38+
await workerQueue.enqueue("indexEndpoint", {
39+
id: endpoint.id,
40+
source: "INTERNAL",
41+
});
5342
}
5443
}
5544
}

0 commit comments

Comments
 (0)