Skip to content

Commit 038c110

Browse files
committed
fix: add void prefix to fire-and-forget setRegion promises in worker.ts
All 10 rpc.setRegion().catch() calls now have explicit void prefix to signal intentional fire-and-forget (prevents no-floating-promises lint).
1 parent 707e3f1 commit 038c110

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/worker.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default {
7979
if (url.searchParams.get("deep") === "true") {
8080
try {
8181
const { rpc, regionName } = getQueryDo(request, env);
82-
rpc.setRegion(regionName).catch(() => {});
82+
void rpc.setRegion(regionName).catch(() => {});
8383
const diagnostics = await rpc.diagnosticsRpc();
8484
return json({ ...base, diagnostics }, 200, headers);
8585
} catch (err) {
@@ -126,7 +126,7 @@ export default {
126126

127127
if (url.pathname === "/query") {
128128
const { rpc, regionName } = getQueryDo(request, env);
129-
rpc.setRegion(regionName).catch(() => {});
129+
void rpc.setRegion(regionName).catch(() => {});
130130
const body = await request.json();
131131
const result = await rpc.queryRpc(body);
132132
result.requestId = requestId;
@@ -135,7 +135,7 @@ export default {
135135

136136
if (url.pathname === "/query/stream") {
137137
const { rpc, regionName } = getQueryDo(request, env);
138-
rpc.setRegion(regionName).catch(() => {});
138+
void rpc.setRegion(regionName).catch(() => {});
139139
const body = await request.json();
140140
const stream = await rpc.streamRpc(body);
141141
return new Response(stream, {
@@ -145,39 +145,39 @@ export default {
145145

146146
if (url.pathname === "/query/count") {
147147
const { rpc, regionName } = getQueryDo(request, env);
148-
rpc.setRegion(regionName).catch(() => {});
148+
void rpc.setRegion(regionName).catch(() => {});
149149
const body = await request.json();
150150
const count = await rpc.countRpc(body);
151151
return json({ count }, 200, headers);
152152
}
153153

154154
if (url.pathname === "/query/exists") {
155155
const { rpc, regionName } = getQueryDo(request, env);
156-
rpc.setRegion(regionName).catch(() => {});
156+
void rpc.setRegion(regionName).catch(() => {});
157157
const body = await request.json();
158158
const exists = await rpc.existsRpc(body);
159159
return json({ exists }, 200, headers);
160160
}
161161

162162
if (url.pathname === "/query/first") {
163163
const { rpc, regionName } = getQueryDo(request, env);
164-
rpc.setRegion(regionName).catch(() => {});
164+
void rpc.setRegion(regionName).catch(() => {});
165165
const body = await request.json();
166166
const row = await rpc.firstRpc(body);
167167
return json({ row }, 200, headers);
168168
}
169169

170170
if (url.pathname === "/query/explain") {
171171
const { rpc, regionName } = getQueryDo(request, env);
172-
rpc.setRegion(regionName).catch(() => {});
172+
void rpc.setRegion(regionName).catch(() => {});
173173
const body = await request.json();
174174
const result = await rpc.explainRpc(body);
175175
return json(result, 200, headers);
176176
}
177177

178178
if (url.pathname === "/tables") {
179179
const { rpc, regionName } = getQueryDo(request, env);
180-
rpc.setRegion(regionName).catch(() => {});
180+
void rpc.setRegion(regionName).catch(() => {});
181181
const result = await rpc.listTablesRpc();
182182
return json(result, 200, headers);
183183
}
@@ -186,15 +186,15 @@ export default {
186186
const table = url.searchParams.get("table");
187187
if (!table) return json({ error: "Missing ?table= parameter" }, 400, headers);
188188
const { rpc, regionName } = getQueryDo(request, env);
189-
rpc.setRegion(regionName).catch(() => {});
189+
void rpc.setRegion(regionName).catch(() => {});
190190
const meta = await rpc.getMetaRpc(table);
191191
if (!meta) return json({ error: `Table "${table}" not found` }, 404, headers);
192192
return json(meta, 200, headers);
193193
}
194194

195195
if (url.pathname === "/register-iceberg") {
196196
const { rpc, regionName } = getQueryDo(request, env);
197-
rpc.setRegion(regionName).catch(() => {});
197+
void rpc.setRegion(regionName).catch(() => {});
198198
const body = await request.json();
199199
const result = await rpc.registerIcebergRpc(body);
200200
return json(result, 200, headers);

0 commit comments

Comments
 (0)