MCPcopy Create free account
hub / github.com/vercel/vercel / constructor

Method constructor

packages/cli/src/util/dev/queue-broker.ts:95–130  ·  view source on GitHub ↗
(
    services: ExperimentalService[],
    private getServiceOrigin: (name: string) => string | null
  )

Source from the content-addressed store, hash-verified

93 private tickTimer: ReturnType<typeof setInterval>;
94
95 constructor(
96 services: ExperimentalService[],
97 private getServiceOrigin: (name: string) => string | null
98 ) {
99 for (const service of services) {
100 if (!isQueueBackedService(service)) continue;
101
102 const topicConfigs = getServiceQueueTopicConfigs(service);
103 for (const topicConfig of topicConfigs) {
104 const topicPattern = topicConfig.topic;
105 const id = `${service.name}::${topicPattern}`;
106 const group: ConsumerGroup = {
107 id,
108 name: service.name,
109 topicPattern,
110 topicRegex: topicPatternToRegex(topicPattern),
111 serviceOriginFn: () => this.getServiceOrigin(service.name),
112 retryAfterMs:
113 topicConfig.retryAfterSeconds !== undefined
114 ? topicConfig.retryAfterSeconds * 1000
115 : DEFAULT_RETRY_AFTER,
116 maxDeliveries: DEFAULT_MAX_DELIVERIES,
117 initialDelayMs:
118 topicConfig.initialDelaySeconds !== undefined
119 ? topicConfig.initialDelaySeconds * 1000
120 : DEFAULT_INITIAL_DELAY,
121 };
122
123 this.consumerGroups.push(group);
124 this.deliveryState.set(group.id, new Map());
125 }
126 }
127
128 this.tickTimer = setInterval(() => this.tick(), TICK_INTERVAL);
129 this.tickTimer.unref();
130 }
131
132 enqueue(
133 queueName: string,

Callers

nothing calls this directly

Calls 8

tickMethod · 0.95
isQueueBackedServiceFunction · 0.90
topicPatternToRegexFunction · 0.85
getServiceOriginMethod · 0.80
pushMethod · 0.65
setMethod · 0.45
unrefMethod · 0.45

Tested by

no test coverage detected