@@ -10,13 +10,12 @@ import { jumpHash } from "@trigger.dev/core/v3/serverOnly";
1010import { Cache , createCache , DefaultStatefulContext , Namespace } from "@unkey/cache" ;
1111import { MemoryStore } from "@unkey/cache/stores" ;
1212import { RedisCacheStore } from "./unkey/redisCacheStore.server" ;
13+ import { env } from "~/env.server" ;
1314
1415export interface CachedLimitProvider {
1516 getCachedLimit : ( organizationId : string , defaultValue : number ) => Promise < number | undefined > ;
1617}
1718
18- const MAXIMUM_CREATED_AT_FILTER_AGE_IN_MS = 7 * 24 * 60 * 60 * 1000 ;
19-
2019const DEFAULT_ELECTRIC_COLUMNS = [
2120 "id" ,
2221 "taskIdentifier" ,
@@ -195,13 +194,13 @@ export class RealtimeClient {
195194 // This means we need to calculate the createdAt filter and store it in redis after we get back the response
196195 const createdAtFilter = safeParseNaturalLanguageDurationAgo ( duration ) ;
197196
198- // Validate that the createdAt filter is in the past, and not more than 1 week in the past.
199- // if it's more than 1 week in the past, just return 1 week ago Date
197+ // Validate that the createdAt filter is in the past, and not more than the maximum age in the past.
198+ // if it's more than the maximum age in the past, just return the maximum age in the past Date
200199 if (
201200 createdAtFilter &&
202- createdAtFilter < new Date ( Date . now ( ) - MAXIMUM_CREATED_AT_FILTER_AGE_IN_MS )
201+ createdAtFilter < new Date ( Date . now ( ) - env . REALTIME_MAXIMUM_CREATED_AT_FILTER_AGE_IN_MS )
203202 ) {
204- return new Date ( Date . now ( ) - MAXIMUM_CREATED_AT_FILTER_AGE_IN_MS ) ;
203+ return new Date ( Date . now ( ) - env . REALTIME_MAXIMUM_CREATED_AT_FILTER_AGE_IN_MS ) ;
205204 }
206205
207206 return createdAtFilter ;
0 commit comments