Skip to content

Commit 1ac2ba1

Browse files
authored
remove tail worker (#16)
1 parent 2a645a8 commit 1ac2ba1

File tree

4 files changed

+20
-68
lines changed

4 files changed

+20
-68
lines changed

confidence-cloudflare-resolver/src/lib.rs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,22 @@ pub async fn main(req: Request, env: Env, _ctx: Context) -> Result<Response> {
207207
.run(req, env)
208208
.await;
209209

210-
let aggregated = FLAG_LOGGER.pop_flag_log_batch();
211-
if !(aggregated.flag_assigned.is_empty()
212-
&& aggregated.flag_resolve_info.is_empty()
213-
&& aggregated.client_resolve_info.is_empty())
214-
{
215-
let converted = serde_json::to_string(&aggregated)?;
216-
console_log!("FLAGS_LOGS_QUEUE:{}", converted);
217-
}
210+
wasm_bindgen_futures::spawn_local(async move {
211+
let aggregated = FLAG_LOGGER.pop_flag_log_batch();
212+
if !(aggregated.flag_assigned.is_empty()
213+
&& aggregated.flag_resolve_info.is_empty()
214+
&& aggregated.client_resolve_info.is_empty())
215+
{
216+
if let Ok(converted) = serde_json::to_string(&aggregated) {
217+
FLAGS_LOGS_QUEUE
218+
.get()
219+
.unwrap()
220+
.send(converted)
221+
.await
222+
.unwrap();
223+
}
224+
}
225+
});
218226

219227
response
220228
}

confidence-cloudflare-resolver/tail/src/index.js

Lines changed: 0 additions & 47 deletions
This file was deleted.

confidence-cloudflare-resolver/tail/wrangler.toml

Lines changed: 0 additions & 12 deletions
This file was deleted.

confidence-cloudflare-resolver/wrangler.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name = "confidence-cloudflare-resolver"
22
main = "build/worker/shim.mjs"
33
compatibility_date = "2025-01-28"
4-
tail_consumers = [{service = "confidence-resolver-tail"}]
54

65
[observability]
76
enabled = true
@@ -11,6 +10,10 @@ queue = "flag-logs-queue"
1110
max_batch_size = 100 # max number of messages in a batch
1211
max_batch_timeout = 10 # seconds
1312

13+
[[queues.producers]]
14+
queue = "flag-logs-queue"
15+
binding = "flag_logs_queue"
16+
1417
[vars]
1518
CONFIDENCE_CLIENT_ID = "ID"
1619
CONFIDENCE_CLIENT_SECRET = "SECRET"

0 commit comments

Comments
 (0)