Skip to content

Commit 11a2b82

Browse files
committed
Update core structures & remove default features
1 parent d37a869 commit 11a2b82

7 files changed

Lines changed: 35 additions & 36 deletions

File tree

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"rust-analyzer.cargo.features": ["deno"],
23
"cSpell.words": [
34
"actix",
45
"bigdecimal",

Cargo.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
[package]
22
name = "openworkers-runner"
3-
version = "0.4.0"
3+
version = "0.5.0"
44
edition = "2024"
55
default-run = "openworkers-runner"
66

77
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
88

99
[features]
10-
default = ["deno"]
10+
default = [] # Explicitly choose a runtime: --features=v8, --features=deno, etc.
1111
deno = ["dep:openworkers-runtime-deno"]
1212
quickjs = ["dep:openworkers-runtime-quickjs"]
1313
v8 = ["dep:openworkers-runtime-v8"]
@@ -25,11 +25,11 @@ env_logger = "0.11.6"
2525
sqlx = { version = "0.8.6", features = [ "runtime-tokio", "postgres", "uuid", "bigdecimal", "rust_decimal" ] }
2626

2727
# Runtime backends (one must be selected via feature flag)
28-
openworkers-runtime-deno = { git = "https://github.com/openworkers/openworkers-runtime-deno", tag = "v0.4.0", features = ["actix"], optional = true }
29-
openworkers-runtime-quickjs = { git = "https://github.com/openworkers/openworkers-runtime-quickjs", tag = "v0.4.0", features = ["actix"], optional = true }
30-
openworkers-runtime-v8 = { git = "https://github.com/openworkers/openworkers-runtime-v8", tag = "v0.4.0", features = ["actix"], optional = true }
31-
openworkers-runtime-boa = { git = "https://github.com/openworkers/openworkers-runtime-boa", tag = "v0.4.0", features = ["actix"], optional = true }
32-
openworkers-runtime-jsc = { git = "https://github.com/openworkers/openworkers-runtime-jsc", tag = "v0.4.0", features = ["actix"], optional = true }
28+
openworkers-runtime-deno = { git = "https://github.com/openworkers/openworkers-runtime-deno", tag = "v0.5.0", features = ["actix"], optional = true }
29+
openworkers-runtime-quickjs = { git = "https://github.com/openworkers/openworkers-runtime-quickjs", tag = "v0.5.0", features = ["actix"], optional = true }
30+
openworkers-runtime-v8 = { git = "https://github.com/openworkers/openworkers-runtime-v8", tag = "v0.5.0", features = ["actix"], optional = true }
31+
openworkers-runtime-boa = { git = "https://github.com/openworkers/openworkers-runtime-boa", tag = "v0.5.0", features = ["actix"], optional = true }
32+
openworkers-runtime-jsc = { git = "https://github.com/openworkers/openworkers-runtime-jsc", tag = "v0.5.0", features = ["actix"], optional = true }
3333

3434
# openworkers-runtime-deno = { path = "../openworkers-runtime-deno", features = ["actix"], optional = true }
3535
# openworkers-runtime-quickjs = { path = "../openworkers-runtime-quickjs", features = ["actix"], optional = true }

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ COPY --from=planner /build/recipe.json recipe.json
1717
RUN --mount=type=cache,target=$CARGO_HOME/git \
1818
--mount=type=cache,target=$CARGO_HOME/registry \
1919
--mount=type=cache,target=/build/target \
20-
cargo chef cook --release --recipe-path recipe.json
20+
cargo chef cook --release --features=deno --recipe-path recipe.json
2121

2222
# Build application
2323
COPY . .
@@ -27,9 +27,9 @@ RUN touch $RUNTIME_SNAPSHOT_PATH
2727
RUN --mount=type=cache,target=$CARGO_HOME/git \
2828
--mount=type=cache,target=$CARGO_HOME/registry \
2929
--mount=type=cache,target=/build/target \
30-
cargo run --release --bin snapshot && \
30+
cargo run --release --features=deno --bin snapshot && \
3131
# Build the runner and copy executable out of the cache so it can be used in the next stage
32-
cargo build --release && cp /build/target/release/openworkers-runner /build/output
32+
cargo build --release --features=deno && cp /build/target/release/openworkers-runner /build/output
3333

3434
FROM debian:bookworm-slim
3535

Dockerfile.multi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ COPY --from=planner /build/recipe.json recipe.json
4747
RUN --mount=type=cache,sharing=locked,target=$CARGO_HOME/git \
4848
--mount=type=cache,sharing=locked,target=$CARGO_HOME/registry \
4949
--mount=type=cache,sharing=locked,target=/build/target \
50-
cargo chef cook --release --recipe-path recipe.json
50+
cargo chef cook --release --features=deno --recipe-path recipe.json
5151

5252
# Build application
5353
COPY . /build
5454

5555
RUN --mount=type=cache,sharing=locked,target=$CARGO_HOME/git \
5656
--mount=type=cache,sharing=locked,target=$CARGO_HOME/registry \
5757
--mount=type=cache,sharing=locked,target=/build/target \
58-
cargo run --release --bin snapshot
58+
cargo run --release --features=deno --bin snapshot
5959

6060
FROM builder AS platform
6161

@@ -68,8 +68,8 @@ RUN --mount=type=cache,id=cargo-$TARGETPLATFORM,sharing=locked,target=$CARGO_HOM
6868
--mount=type=cache,id=cargo-$TARGETPLATFORM,sharing=locked,target=$CARGO_HOME/registry \
6969
--mount=type=cache,id=cargo-$TARGETPLATFORM,sharing=locked,target=/build/target \
7070
case "$TARGETPLATFORM" in \
71-
"linux/arm64") cargo chef cook --release --target aarch64-unknown-linux-gnu --recipe-path recipe.json ;; \
72-
"linux/amd64") cargo chef cook --release --target x86_64-unknown-linux-gnu --recipe-path recipe.json ;; \
71+
"linux/arm64") cargo chef cook --release --features=deno --target aarch64-unknown-linux-gnu --recipe-path recipe.json ;; \
72+
"linux/amd64") cargo chef cook --release --features=deno --target x86_64-unknown-linux-gnu --recipe-path recipe.json ;; \
7373
*) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \
7474
esac
7575

@@ -78,9 +78,9 @@ RUN --mount=type=cache,id=cargo-$TARGETPLATFORM,sharing=locked,target=$CARGO_HOM
7878
--mount=type=cache,id=cargo-$TARGETPLATFORM,sharing=locked,target=$CARGO_HOME/registry \
7979
--mount=type=cache,id=cargo-$TARGETPLATFORM,sharing=locked,target=/build/target \
8080
case "$TARGETPLATFORM" in \
81-
"linux/arm64") cargo build --release --target aarch64-unknown-linux-gnu && \
81+
"linux/arm64") cargo build --release --features=deno --target aarch64-unknown-linux-gnu && \
8282
mv /build/target/aarch64-unknown-linux-gnu/release/openworkers-runner /build/output ;; \
83-
"linux/amd64") cargo build --release --target x86_64-unknown-linux-gnu && \
83+
"linux/amd64") cargo build --release --features=deno --target x86_64-unknown-linux-gnu && \
8484
mv /build/target/x86_64-unknown-linux-gnu/release/openworkers-runner /build/output ;; \
8585
*) echo "Unsupported platform: $TARGETPLATFORM" && exit 1 ;; \
8686
esac

src/event_fetch.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ use std::time::Duration;
33
use tokio::sync::OwnedSemaphorePermit;
44

55
use crate::runtime::{
6-
FetchInit, HttpRequest, HttpResponse, ResponseBody, RuntimeLimits, Script, Task,
7-
TerminationReason, Worker,
6+
FetchInit, HttpRequest, HttpResponse, ResponseBody, ResponseSender, RuntimeLimits, Script,
7+
Task, TerminationReason, Worker,
88
};
99

1010
use crate::store::WorkerData;
1111
use crate::worker_pool::WORKER_POOL;
1212

13-
type ResTx = tokio::sync::oneshot::Sender<HttpResponse>;
1413
type TerminationTx = tokio::sync::oneshot::Sender<Result<(), TerminationReason>>;
1514

1615
// Default timeout for fetch events
@@ -19,7 +18,7 @@ const FETCH_TIMEOUT_MS: u64 = 64_000; // 64 seconds
1918
pub fn run_fetch(
2019
worker: WorkerData,
2120
req: HttpRequest,
22-
res_tx: ResTx,
21+
res_tx: ResponseSender,
2322
termination_tx: TerminationTx,
2423
global_log_tx: std::sync::mpsc::Sender<crate::log::LogMessage>,
2524
permit: OwnedSemaphorePermit,

src/nats.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ pub async fn nats_connect() -> async_nats::Client {
66

77
log::debug!("connecting to nats: {nats_servers}");
88

9-
match std::env::var("NATS_CREDS") {
9+
match std::env::var("NATS_CREDENTIALS") {
1010
Ok(credentials) => {
1111
let credentials = STANDARD
1212
.decode(credentials)
13-
.expect("env NATS_CREDS must be valid base64");
14-
13+
.expect("env NATS_CREDENTIALS must be valid base64");
1514
let credentials_str =
16-
String::from_utf8(credentials).expect("env NATS_CREDS must be valid UTF-8");
15+
String::from_utf8(credentials).expect("env NATS_CREDENTIALS must be valid UTF-8");
1716

1817
async_nats::ConnectOptions::with_credentials(&credentials_str)
1918
.expect("invalid NATS credentials format")

0 commit comments

Comments
 (0)