Skip to content

Commit 3ffbb0d

Browse files
committed
feat: move excempted error codes into cronjob
it no longer makes sense to keep the error codes in the marketplace sdk as the only place they will be used is here.
1 parent bc4976e commit 3ffbb0d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/cron/OrderInvalidation.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,19 @@
11
import cron from "node-cron";
2-
import { ACCEPTED_ERROR_CODES } from "@hypercerts-org/marketplace-sdk";
2+
import { OrderValidatorCode } from "@hypercerts-org/marketplace-sdk";
33
import { SupabaseDataService } from "../services/SupabaseDataService.js";
44
import _ from "lodash";
55
import { kyselyData } from "../client/kysely.js";
66
import { sql } from "kysely";
77

8+
/**
9+
* These error codes are considered temporary and should be
10+
* rechecked periodically so that they can be marked as valid again.
11+
*/
12+
export const TEMPORARILY_INVALID_ERROR_CODES = [
13+
OrderValidatorCode.ORDER_EXPECTED_TO_BE_VALID,
14+
OrderValidatorCode.TOO_EARLY_TO_EXECUTE_ORDER,
15+
];
16+
817
export default class OrderInvalidationCronjob {
918
private static instance: OrderInvalidationCronjob;
1019
private dataService: SupabaseDataService;
@@ -45,7 +54,7 @@ export default class OrderInvalidationCronjob {
4554
"validator_codes",
4655
"<@",
4756
// @ts-expect-error Typing issue with sql arrays
48-
sql`ARRAY[${sql.join(ACCEPTED_ERROR_CODES)}]::int4[]`,
57+
sql`ARRAY[${sql.join(TEMPORARILY_INVALID_ERROR_CODES)}]::int4[]`,
4958
),
5059
]),
5160
)

0 commit comments

Comments
 (0)