mirror of
https://github.com/aljazceru/blastr.git
synced 2025-12-17 22:14:20 +01:00
Merge pull request #15 from MutinyWallet/less-queues
Temporarily lower the queues
This commit is contained in:
@@ -11,8 +11,7 @@ default = ["console_error_panic_hook"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cfg-if = "0.1.2"
|
cfg-if = "0.1.2"
|
||||||
# Need the queue feature
|
worker = { version = "0.0.13", features = ["queue"] }
|
||||||
worker = { git = "https://github.com/cloudflare/workers-rs", rev = "b4b9cd1f15feac412b6f9e9e9209458cd3b98430", features = ["queue"] }
|
|
||||||
futures = "0.3.26"
|
futures = "0.3.26"
|
||||||
# Needed for serde serializaters
|
# Needed for serde serializaters
|
||||||
nostr = { git = "https://github.com/benthecarman/nostr", rev = "6c238ac72651671bcfd6666ddcd731767d1643b8" }
|
nostr = { git = "https://github.com/benthecarman/nostr", rev = "6c238ac72651671bcfd6666ddcd731767d1643b8" }
|
||||||
|
|||||||
28
src/lib.rs
28
src/lib.rs
@@ -79,13 +79,13 @@ pub async fn main(req: Request, env: Env, _ctx: Context) -> Result<Response> {
|
|||||||
ctx.env.queue(NOSTR_QUEUE).expect("get queue"),
|
ctx.env.queue(NOSTR_QUEUE).expect("get queue"),
|
||||||
ctx.env.queue(NOSTR_QUEUE_2).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_3).expect("get queue"),
|
||||||
ctx.env.queue(NOSTR_QUEUE_4).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_5).expect("get queue"),
|
||||||
ctx.env.queue(NOSTR_QUEUE_6).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_7).expect("get queue"),
|
||||||
ctx.env.queue(NOSTR_QUEUE_8).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_9).expect("get queue"),
|
||||||
ctx.env.queue(NOSTR_QUEUE_10).expect("get queue"),
|
//ctx.env.queue(NOSTR_QUEUE_10).expect("get queue"),
|
||||||
];
|
];
|
||||||
try_queue_event(*event.clone(), nostr_queues).await;
|
try_queue_event(*event.clone(), nostr_queues).await;
|
||||||
console_log!("queued up nostr event: {}", event.id);
|
console_log!("queued up nostr event: {}", event.id);
|
||||||
@@ -192,13 +192,13 @@ pub async fn main(req: Request, env: Env, _ctx: Context) -> Result<Response> {
|
|||||||
ctx.env.queue(NOSTR_QUEUE).expect("get queue"),
|
ctx.env.queue(NOSTR_QUEUE).expect("get queue"),
|
||||||
ctx.env.queue(NOSTR_QUEUE_2).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_3).expect("get queue"),
|
||||||
ctx.env.queue(NOSTR_QUEUE_4).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_5).expect("get queue"),
|
||||||
ctx.env.queue(NOSTR_QUEUE_6).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_7).expect("get queue"),
|
||||||
ctx.env.queue(NOSTR_QUEUE_8).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_9).expect("get queue"),
|
||||||
ctx.env.queue(NOSTR_QUEUE_10).expect("get queue"),
|
//ctx.env.queue(NOSTR_QUEUE_10).expect("get queue"),
|
||||||
];
|
];
|
||||||
try_queue_event(*event.clone(), nostr_queues).await;
|
try_queue_event(*event.clone(), nostr_queues).await;
|
||||||
console_log!("queued up nostr event: {}", event.id);
|
console_log!("queued up nostr event: {}", event.id);
|
||||||
|
|||||||
20
src/nostr.rs
20
src/nostr.rs
@@ -8,16 +8,16 @@ use std::{time::Duration, vec};
|
|||||||
use worker::WebsocketEvent;
|
use worker::WebsocketEvent;
|
||||||
use worker::{console_log, Cache, Delay, Fetch, Queue, Response, WebSocket};
|
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: &str = "nostr-events-pub-1-b";
|
||||||
pub(crate) const NOSTR_QUEUE_2: &str = "nostr-events-pub-2";
|
pub(crate) const NOSTR_QUEUE_2: &str = "nostr-events-pub-2-b";
|
||||||
pub(crate) const NOSTR_QUEUE_3: &str = "nostr-events-pub-3";
|
pub(crate) const NOSTR_QUEUE_3: &str = "nostr-events-pub-3-b";
|
||||||
pub(crate) const NOSTR_QUEUE_4: &str = "nostr-events-pub-4";
|
pub(crate) const NOSTR_QUEUE_4: &str = "nostr-events-pub-4-b";
|
||||||
pub(crate) const NOSTR_QUEUE_5: &str = "nostr-events-pub-5";
|
pub(crate) const NOSTR_QUEUE_5: &str = "nostr-events-pub-5-b";
|
||||||
pub(crate) const NOSTR_QUEUE_6: &str = "nostr-events-pub-6-a";
|
pub(crate) const NOSTR_QUEUE_6: &str = "nostr-events-pub-6-b";
|
||||||
pub(crate) const NOSTR_QUEUE_7: &str = "nostr-events-pub-7";
|
pub(crate) const NOSTR_QUEUE_7: &str = "nostr-events-pub-7-b";
|
||||||
pub(crate) const NOSTR_QUEUE_8: &str = "nostr-events-pub-8";
|
pub(crate) const NOSTR_QUEUE_8: &str = "nostr-events-pub-8-b";
|
||||||
pub(crate) const NOSTR_QUEUE_9: &str = "nostr-events-pub-9";
|
pub(crate) const NOSTR_QUEUE_9: &str = "nostr-events-pub-9-b";
|
||||||
pub(crate) const NOSTR_QUEUE_10: &str = "nostr-events-pub-10";
|
pub(crate) const NOSTR_QUEUE_10: &str = "nostr-events-pub-10-b";
|
||||||
const RELAY_LIST_URL: &str = "https://api.nostr.watch/v1/online";
|
const RELAY_LIST_URL: &str = "https://api.nostr.watch/v1/online";
|
||||||
const RELAYS: [&str; 8] = [
|
const RELAYS: [&str; 8] = [
|
||||||
"wss://nostr.zebedee.cloud",
|
"wss://nostr.zebedee.cloud",
|
||||||
|
|||||||
@@ -13,99 +13,98 @@ kv_namespaces = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[vars]
|
[vars]
|
||||||
WORKERS_RS_VERSION = "0.0.11"
|
WORKERS_RS_VERSION = "0.0.13"
|
||||||
|
|
||||||
[[queues.producers]]
|
[[queues.producers]]
|
||||||
queue = "nostr-events-pub-1"
|
queue = "nostr-events-pub-1-b"
|
||||||
binding = "nostr-events-pub-1"
|
binding = "nostr-events-pub-1-b"
|
||||||
|
|
||||||
[[queues.producers]]
|
[[queues.producers]]
|
||||||
queue = "nostr-events-pub-2"
|
queue = "nostr-events-pub-2-b"
|
||||||
binding = "nostr-events-pub-2"
|
binding = "nostr-events-pub-2-b"
|
||||||
|
|
||||||
[[queues.producers]]
|
[[queues.producers]]
|
||||||
queue = "nostr-events-pub-3"
|
queue = "nostr-events-pub-3-b"
|
||||||
binding = "nostr-events-pub-3"
|
binding = "nostr-events-pub-3-b"
|
||||||
|
|
||||||
[[queues.producers]]
|
[[queues.producers]]
|
||||||
queue = "nostr-events-pub-4"
|
queue = "nostr-events-pub-4-b"
|
||||||
binding = "nostr-events-pub-4"
|
binding = "nostr-events-pub-4-b"
|
||||||
|
|
||||||
[[queues.producers]]
|
[[queues.producers]]
|
||||||
queue = "nostr-events-pub-5"
|
queue = "nostr-events-pub-5-b"
|
||||||
binding = "nostr-events-pub-5"
|
binding = "nostr-events-pub-5-b"
|
||||||
|
|
||||||
[[queues.producers]]
|
[[queues.producers]]
|
||||||
queue = "nostr-events-pub-6-a"
|
queue = "nostr-events-pub-6-b"
|
||||||
binding = "nostr-events-pub-6-a"
|
binding = "nostr-events-pub-6-b"
|
||||||
|
|
||||||
[[queues.producers]]
|
[[queues.producers]]
|
||||||
queue = "nostr-events-pub-7"
|
queue = "nostr-events-pub-7-b"
|
||||||
binding = "nostr-events-pub-7"
|
binding = "nostr-events-pub-7-b"
|
||||||
|
|
||||||
[[queues.producers]]
|
[[queues.producers]]
|
||||||
queue = "nostr-events-pub-8"
|
queue = "nostr-events-pub-8-b"
|
||||||
binding = "nostr-events-pub-8"
|
binding = "nostr-events-pub-8-b"
|
||||||
|
|
||||||
[[queues.producers]]
|
[[queues.producers]]
|
||||||
queue = "nostr-events-pub-9"
|
queue = "nostr-events-pub-9-b"
|
||||||
binding = "nostr-events-pub-9"
|
binding = "nostr-events-pub-9-b"
|
||||||
|
|
||||||
[[queues.producers]]
|
[[queues.producers]]
|
||||||
queue = "nostr-events-pub-10"
|
queue = "nostr-events-pub-10-b"
|
||||||
binding = "nostr-events-pub-10"
|
binding = "nostr-events-pub-10-b"
|
||||||
|
|
||||||
# consumers
|
# consumers
|
||||||
[[queues.consumers]]
|
[[queues.consumers]]
|
||||||
queue = "nostr-events-pub-1"
|
queue = "nostr-events-pub-1-b"
|
||||||
max_batch_size = 20
|
max_batch_size = 20
|
||||||
max_batch_timeout = 5 # this is the best one, run quicker
|
max_batch_timeout = 5 # this is the best one, run quicker
|
||||||
|
|
||||||
[[queues.consumers]]
|
[[queues.consumers]]
|
||||||
queue = "nostr-events-pub-2"
|
queue = "nostr-events-pub-2-b"
|
||||||
max_batch_size = 20
|
max_batch_size = 20
|
||||||
max_batch_timeout = 15
|
max_batch_timeout = 15
|
||||||
|
|
||||||
[[queues.consumers]]
|
[[queues.consumers]]
|
||||||
queue = "nostr-events-pub-3"
|
queue = "nostr-events-pub-3-b"
|
||||||
max_batch_size = 20
|
max_batch_size = 20
|
||||||
max_batch_timeout = 15
|
max_batch_timeout = 15
|
||||||
|
|
||||||
[[queues.consumers]]
|
[[queues.consumers]]
|
||||||
queue = "nostr-events-pub-4"
|
queue = "nostr-events-pub-4-b"
|
||||||
max_batch_size = 20
|
max_batch_size = 20
|
||||||
max_batch_timeout = 15
|
max_batch_timeout = 15
|
||||||
|
|
||||||
[[queues.consumers]]
|
[[queues.consumers]]
|
||||||
queue = "nostr-events-pub-5"
|
queue = "nostr-events-pub-5-b"
|
||||||
max_batch_size = 20
|
max_batch_size = 20
|
||||||
max_batch_timeout = 15
|
max_batch_timeout = 15
|
||||||
|
|
||||||
[[queues.consumers]]
|
[[queues.consumers]]
|
||||||
queue = "nostr-events-pub-6-a"
|
queue = "nostr-events-pub-6-b"
|
||||||
max_batch_size = 20
|
max_batch_size = 20
|
||||||
max_batch_timeout = 15
|
max_batch_timeout = 15
|
||||||
|
|
||||||
[[queues.consumers]]
|
[[queues.consumers]]
|
||||||
queue = "nostr-events-pub-7"
|
queue = "nostr-events-pub-7-b"
|
||||||
max_batch_size = 20
|
max_batch_size = 20
|
||||||
max_batch_timeout = 15
|
max_batch_timeout = 15
|
||||||
|
|
||||||
[[queues.consumers]]
|
[[queues.consumers]]
|
||||||
queue = "nostr-events-pub-8"
|
queue = "nostr-events-pub-8-b"
|
||||||
max_batch_size = 20
|
max_batch_size = 20
|
||||||
max_batch_timeout = 15
|
max_batch_timeout = 15
|
||||||
|
|
||||||
[[queues.consumers]]
|
[[queues.consumers]]
|
||||||
queue = "nostr-events-pub-9"
|
queue = "nostr-events-pub-9-b"
|
||||||
max_batch_size = 20
|
max_batch_size = 20
|
||||||
max_batch_timeout = 15
|
max_batch_timeout = 15
|
||||||
|
|
||||||
[[queues.consumers]]
|
[[queues.consumers]]
|
||||||
queue = "nostr-events-pub-10"
|
queue = "nostr-events-pub-10-b"
|
||||||
max_batch_size = 20
|
max_batch_size = 20
|
||||||
max_batch_timeout = 15
|
max_batch_timeout = 15
|
||||||
|
|
||||||
[build]
|
[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.9 && worker-build --release"
|
||||||
#command = "cargo install -q worker-build --version 0.0.7 && worker-build --release"
|
|
||||||
|
|||||||
Reference in New Issue
Block a user