diff --git a/Cargo.toml b/Cargo.toml index 4f93bda..56f91b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,7 @@ default = ["console_error_panic_hook"] [dependencies] cfg-if = "0.1.2" -# Need the queue feature -worker = { git = "https://github.com/cloudflare/workers-rs", rev = "b4b9cd1f15feac412b6f9e9e9209458cd3b98430", features = ["queue"] } +worker = { version = "0.0.13", features = ["queue"] } futures = "0.3.26" # Needed for serde serializaters nostr = { git = "https://github.com/benthecarman/nostr", rev = "6c238ac72651671bcfd6666ddcd731767d1643b8" } diff --git a/src/lib.rs b/src/lib.rs index 45c8a04..45e4fe0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -79,13 +79,13 @@ pub async fn main(req: Request, env: Env, _ctx: Context) -> Result { ctx.env.queue(NOSTR_QUEUE).expect("get queue"), ctx.env.queue(NOSTR_QUEUE_2).expect("get queue"), ctx.env.queue(NOSTR_QUEUE_3).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_4).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_5).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_6).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_7).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_8).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_9).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_10).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_4).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_5).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_6).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_7).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_8).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_9).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_10).expect("get queue"), ]; try_queue_event(*event.clone(), nostr_queues).await; console_log!("queued up nostr event: {}", event.id); @@ -192,13 +192,13 @@ pub async fn main(req: Request, env: Env, _ctx: Context) -> Result { ctx.env.queue(NOSTR_QUEUE).expect("get queue"), ctx.env.queue(NOSTR_QUEUE_2).expect("get queue"), ctx.env.queue(NOSTR_QUEUE_3).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_4).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_5).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_6).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_7).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_8).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_9).expect("get queue"), - ctx.env.queue(NOSTR_QUEUE_10).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_4).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_5).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_6).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_7).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_8).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_9).expect("get queue"), + //ctx.env.queue(NOSTR_QUEUE_10).expect("get queue"), ]; try_queue_event(*event.clone(), nostr_queues).await; console_log!("queued up nostr event: {}", event.id); diff --git a/src/nostr.rs b/src/nostr.rs index 3fd938d..7534a51 100644 --- a/src/nostr.rs +++ b/src/nostr.rs @@ -8,16 +8,16 @@ use std::{time::Duration, vec}; use worker::WebsocketEvent; use worker::{console_log, Cache, Delay, Fetch, Queue, Response, WebSocket}; -pub(crate) const NOSTR_QUEUE: &str = "nostr-events-pub-1"; -pub(crate) const NOSTR_QUEUE_2: &str = "nostr-events-pub-2"; -pub(crate) const NOSTR_QUEUE_3: &str = "nostr-events-pub-3"; -pub(crate) const NOSTR_QUEUE_4: &str = "nostr-events-pub-4"; -pub(crate) const NOSTR_QUEUE_5: &str = "nostr-events-pub-5"; -pub(crate) const NOSTR_QUEUE_6: &str = "nostr-events-pub-6-a"; -pub(crate) const NOSTR_QUEUE_7: &str = "nostr-events-pub-7"; -pub(crate) const NOSTR_QUEUE_8: &str = "nostr-events-pub-8"; -pub(crate) const NOSTR_QUEUE_9: &str = "nostr-events-pub-9"; -pub(crate) const NOSTR_QUEUE_10: &str = "nostr-events-pub-10"; +pub(crate) const NOSTR_QUEUE: &str = "nostr-events-pub-1-b"; +pub(crate) const NOSTR_QUEUE_2: &str = "nostr-events-pub-2-b"; +pub(crate) const NOSTR_QUEUE_3: &str = "nostr-events-pub-3-b"; +pub(crate) const NOSTR_QUEUE_4: &str = "nostr-events-pub-4-b"; +pub(crate) const NOSTR_QUEUE_5: &str = "nostr-events-pub-5-b"; +pub(crate) const NOSTR_QUEUE_6: &str = "nostr-events-pub-6-b"; +pub(crate) const NOSTR_QUEUE_7: &str = "nostr-events-pub-7-b"; +pub(crate) const NOSTR_QUEUE_8: &str = "nostr-events-pub-8-b"; +pub(crate) const NOSTR_QUEUE_9: &str = "nostr-events-pub-9-b"; +pub(crate) const NOSTR_QUEUE_10: &str = "nostr-events-pub-10-b"; const RELAY_LIST_URL: &str = "https://api.nostr.watch/v1/online"; const RELAYS: [&str; 8] = [ "wss://nostr.zebedee.cloud", diff --git a/wrangler.toml b/wrangler.toml index e9fccd0..4895c89 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -13,99 +13,98 @@ kv_namespaces = [ ] [vars] -WORKERS_RS_VERSION = "0.0.11" +WORKERS_RS_VERSION = "0.0.13" [[queues.producers]] - queue = "nostr-events-pub-1" - binding = "nostr-events-pub-1" + queue = "nostr-events-pub-1-b" + binding = "nostr-events-pub-1-b" [[queues.producers]] - queue = "nostr-events-pub-2" - binding = "nostr-events-pub-2" + queue = "nostr-events-pub-2-b" + binding = "nostr-events-pub-2-b" [[queues.producers]] - queue = "nostr-events-pub-3" - binding = "nostr-events-pub-3" + queue = "nostr-events-pub-3-b" + binding = "nostr-events-pub-3-b" [[queues.producers]] - queue = "nostr-events-pub-4" - binding = "nostr-events-pub-4" + queue = "nostr-events-pub-4-b" + binding = "nostr-events-pub-4-b" [[queues.producers]] - queue = "nostr-events-pub-5" - binding = "nostr-events-pub-5" + queue = "nostr-events-pub-5-b" + binding = "nostr-events-pub-5-b" [[queues.producers]] - queue = "nostr-events-pub-6-a" - binding = "nostr-events-pub-6-a" + queue = "nostr-events-pub-6-b" + binding = "nostr-events-pub-6-b" [[queues.producers]] - queue = "nostr-events-pub-7" - binding = "nostr-events-pub-7" + queue = "nostr-events-pub-7-b" + binding = "nostr-events-pub-7-b" [[queues.producers]] - queue = "nostr-events-pub-8" - binding = "nostr-events-pub-8" + queue = "nostr-events-pub-8-b" + binding = "nostr-events-pub-8-b" [[queues.producers]] - queue = "nostr-events-pub-9" - binding = "nostr-events-pub-9" + queue = "nostr-events-pub-9-b" + binding = "nostr-events-pub-9-b" [[queues.producers]] - queue = "nostr-events-pub-10" - binding = "nostr-events-pub-10" + queue = "nostr-events-pub-10-b" + binding = "nostr-events-pub-10-b" # consumers [[queues.consumers]] - queue = "nostr-events-pub-1" + queue = "nostr-events-pub-1-b" max_batch_size = 20 max_batch_timeout = 5 # this is the best one, run quicker [[queues.consumers]] - queue = "nostr-events-pub-2" + queue = "nostr-events-pub-2-b" max_batch_size = 20 max_batch_timeout = 15 [[queues.consumers]] - queue = "nostr-events-pub-3" + queue = "nostr-events-pub-3-b" max_batch_size = 20 max_batch_timeout = 15 [[queues.consumers]] - queue = "nostr-events-pub-4" + queue = "nostr-events-pub-4-b" max_batch_size = 20 max_batch_timeout = 15 [[queues.consumers]] - queue = "nostr-events-pub-5" + queue = "nostr-events-pub-5-b" max_batch_size = 20 max_batch_timeout = 15 [[queues.consumers]] - queue = "nostr-events-pub-6-a" + queue = "nostr-events-pub-6-b" max_batch_size = 20 max_batch_timeout = 15 [[queues.consumers]] - queue = "nostr-events-pub-7" + queue = "nostr-events-pub-7-b" max_batch_size = 20 max_batch_timeout = 15 [[queues.consumers]] - queue = "nostr-events-pub-8" + queue = "nostr-events-pub-8-b" max_batch_size = 20 max_batch_timeout = 15 [[queues.consumers]] - queue = "nostr-events-pub-9" + queue = "nostr-events-pub-9-b" max_batch_size = 20 max_batch_timeout = 15 [[queues.consumers]] - queue = "nostr-events-pub-10" + queue = "nostr-events-pub-10-b" max_batch_size = 20 max_batch_timeout = 15 [build] -command = "cargo install --git https://github.com/CathalMullan/workers-rs worker-build && worker-build --release" -#command = "cargo install -q worker-build --version 0.0.7 && worker-build --release" +command = "cargo install -q worker-build --version 0.0.9 && worker-build --release"