MCPcopy
hub / github.com/cursor/community-plugins / kickDrainAfterResponse

Function kickDrainAfterResponse

apps/cursor/src/lib/plugins/queue.ts:87–106  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

85 * still in the queue and gets drained on the next tick.
86 */
87export function kickDrainAfterResponse(): void {
88 const cronSecret = process.env.CRON_SECRET;
89 if (!cronSecret) {
90 // In dev without CRON_SECRET we silently skip the kick. The drain route
91 // would 500 anyway (requireCronAuth fail-closes when CRON_SECRET is unset).
92 return;
93 }
94
95 after(async () => {
96 try {
97 await fetch(`${drainBaseUrl()}${DRAIN_PATH}`, {
98 headers: { Authorization: `Bearer ${cronSecret}` },
99 });
100 } catch (err) {
101 // Best-effort kick; the cron will retry. Logging keeps us honest about
102 // how often the kick path fails so we can spot regressions.
103 console.error("[queue] kick drain failed (cron will retry)", err);
104 }
105 });
106}

Callers 3

update-plugin.tsFile · 0.90
insertPluginFunction · 0.90

Calls 1

drainBaseUrlFunction · 0.85

Tested by

no test coverage detected