Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
1e97365
valkey: drop discriminant PartialEq on TLS; add TLS::is_none()
robobun Jul 20, 2026
2f005d1
valkey: route reconnect fail through client, report on_message errors
robobun Jul 20, 2026
919d83f
valkey: fix PUNSUBSCRIBE typo, case-insensitive pipeline check
robobun Jul 20, 2026
638a07c
valkey: drop lying JsTerminated aliases; drain reject_all fully
robobun Jul 20, 2026
cd389db
valkey: simplify upsert_receive_handler; scope subscribe() rollback
robobun Jul 20, 2026
8548e07
valkey: flatten valkey_jsc mod.rs — drop alias maze, one canonical path
robobun Jul 20, 2026
08465b0
valkey: [u8;3] format, move Push.kind, private leaf readers, re-exports
robobun Jul 20, 2026
264d51a
valkey: drop dead params and phantom return types
robobun Jul 20, 2026
0180768
valkey: collapse Meta onto Promise; drop PromisePair/Entry.meta dup
robobun Jul 20, 2026
ef6dfd9
valkey: add ServerError code; drop dead RedisError arms in to_js map
robobun Jul 20, 2026
30950c5
valkey: delete dead code (connection_strings, on_valkey_timeout, stal…
robobun Jul 20, 2026
db68ee6
valkey: rollback only the handler added when SUBSCRIBE send fails
robobun Jul 20, 2026
94a6dcb
valkey: fire onclose when reconnect's connect() errors
robobun Jul 20, 2026
8733036
valkey: use ServerError code for subscriber RESP errors; document code
robobun Jul 20, 2026
6ed93f5
valkeyseal round 1: land edits the per-item commits missed
robobun Jul 20, 2026
1b188af
valkey: send_err_to_js returns rejected Promise, not bare Error
robobun Jul 20, 2026
bba753a
valkey: encapsulate JS-wrapper binding in JSValkeyClient::bind_js
robobun Jul 20, 2026
3f15c8d
valkey: derive Clone for Address/TLS; drop unreachable!() reconstruction
robobun Jul 20, 2026
db6c144
valkey: *-1 -> Null, validate _\r\n, BigNumber always string
robobun Jul 20, 2026
b9480e2
valkey: replace handshake bools with Handshake enum; add mark_connected
robobun Jul 20, 2026
5b28830
valkey: type handle_subscribe_response on Push; settle popped promise
robobun Jul 20, 2026
15f742b
valkey: pass method names as &str; drop bname()+unsafe; fix labels
robobun Jul 20, 2026
016118c
valkey: exhaustive SubscriptionPushMessage; drop is_reply_kind hack
robobun Jul 20, 2026
ffdf202
valkey: cmd_key* macros accept $meta; collapse 14 hand-written methods
robobun Jul 20, 2026
92ce63a
valkey: resp_value_to_js by value; OOM via create_out_of_memory_error…
robobun Jul 20, 2026
d05e5c9
valkey: unify varargs policy to throw; fix file-blob/arg0 label
robobun Jul 20, 2026
ea8d2c1
valkey: restore validate_integer_range guard on expire(seconds)
robobun Jul 20, 2026
91bc900
valkey: fix E0521 in collect_varargs by using &'static str params
robobun Jul 20, 2026
b7ff8af
valkey: skip pmessage pattern before on_valkey_message dispatch
robobun Jul 20, 2026
61778a7
valkey: connection_ready() requires Connected; drop reachable unreach…
robobun Jul 20, 2026
6dd8d1d
valkey: flatten command Entry/Promise queue type aliases
robobun Jul 20, 2026
7e22cc7
valkey: wrap _secure in OwnedSslCtx RAII, drop manual SSL_CTX_free
robobun Jul 20, 2026
8bea128
valkey: read_value() returns Option so Err is always a protocol error
robobun Jul 20, 2026
ac84fd4
valkey: drop six unused deps from bun_valkey Cargo.toml
robobun Jul 20, 2026
29ef955
valkey: add ClientStateRequirement::Subscriber; gate punsubscribe
robobun Jul 20, 2026
271f2ea
valkey: table-drive RedisClient command proto; fill 55 missing lengths
robobun Jul 20, 2026
16f089b
valkey: inline on_valkey_* forwarders; global_object takes &self
robobun Jul 20, 2026
f46e241
valkey: drop dead ValkeyClient.protocol; use Protocol::is_unix()
robobun Jul 20, 2026
34155fd
valkey: fold SubscriptionCtx bools into Option<SavedFlags>; Option map
robobun Jul 20, 2026
434c14a
valkey: derive send_cmd err from command; add require_arg; drop dup m…
robobun Jul 20, 2026
324eb8b
valkey: reuse boringssl::c::OwnedSslCtx for _secure field
robobun Jul 20, 2026
308074f
valkey: revert punsubscribe Subscriber gate; restore require_subscrib…
robobun Jul 20, 2026
cad1a3e
valkeyseal round 3: land edits the per-item commits missed
robobun Jul 20, 2026
20b2892
valkey: hset_impl use JSValue::to_slice for RAII string release
robobun Jul 20, 2026
3877aff
valkey: Options::default honors env flag; drop Options shim struct
robobun Jul 20, 2026
101b717
valkey: fold RETURN_AS_BOOL into command::Promise::resolve
robobun Jul 20, 2026
30a396b
valkey: surface TLS ctx error; stop JsResult leaking from connect()
robobun Jul 20, 2026
675fe62
valkey: defer unsubscribe handler-map mutation until send() succeeds
robobun Jul 20, 2026
d01c7a3
valkey: SocketHandler methods uniformly return JsResult<()>
robobun Jul 20, 2026
3f39690
valkey: on_close releases socket-ref even if fail() throws
robobun Jul 20, 2026
159e7d6
valkey: extract read_aggregate_header/read_n_values/read_n_entries
robobun Jul 20, 2026
0c9df11
valkey: fix length comment; guard reserved proto slot collisions
robobun Jul 20, 2026
1cda92c
valkey: extract parse_valkey_url + new_disconnected; dedupe ctor literal
robobun Jul 20, 2026
1d235aa
valkey: publish via cmd_key_value!; js_send via send_cmd; ERR_INVALID…
robobun Jul 20, 2026
ebe2dc0
valkey: propagate JsResult from unsubscribe rollback (OOM-only Err path)
robobun Jul 20, 2026
d4ce4bb
valkey: use ERR_MISSING_ARGS for arity errors in command fns
robobun Jul 20, 2026
3893a34
valkey: update BlobError torn-read test for reject semantics
robobun Jul 20, 2026
70b8ecc
valkey: don't tear down connection on subscriber error/push
robobun Jul 20, 2026
4e96bad
valkey: report JSMap::size exception instead of discarding it
robobun Jul 20, 2026
d8d3aac
valkey: extract JSValkeyClient::fail_fmt for stack-buffer formatting
robobun Jul 20, 2026
776fa3d
valkey: collapse on_writable+update_poll_ref into flush_and_update_po…
robobun Jul 20, 2026
bf6b4ed
valkey: simplify enqueue() routing and on_close() reconnect predicate
robobun Jul 20, 2026
d6f7698
valkey: iterate both ring-buffer halves when scanning queue
robobun Jul 20, 2026
2e6a391
valkey: on_auto_flush stays unregistered when no progress made
robobun Jul 20, 2026
da3ec49
valkey: BigNumber honours return_as_buffer; merge identical arms
robobun Jul 20, 2026
08defc3
valkey: surface connect errno instead of generic 'Connection closed'
robobun Jul 20, 2026
864cbff
valkey: safe stringify channel_name in invoke_callbacks debug log
robobun Jul 20, 2026
0df529e
valkey: lift wrapped-ring iter onto LinearFifo; drop iter_entries
robobun Jul 20, 2026
dfcd00d
valkey: fix WTFStringImpl leak + swallowed throw in invoke_callbacks …
robobun Jul 20, 2026
22f49f4
valkey: accept 'connect E<errno>' in connection-failure test regexes
robobun Jul 20, 2026
00bc522
valkey: compute sub_count only in subscribe-ack arm
robobun Jul 20, 2026
c01daed
valkey: rename command::Args::Args variant to Blobs
robobun Jul 20, 2026
09e2863
valkey: derive protocol-scheme error list from PROTOCOL_MAP.keys()
robobun Jul 20, 2026
667edc1
valkey: rename free from_js helper to coerce_redis_arg
robobun Jul 20, 2026
15e5f78
valkey: drop dead post-enqueue flusher re-register and empty-queue drain
robobun Jul 20, 2026
13f228e
valkey: always include RedisError variant in JS error message
robobun Jul 20, 2026
35990d9
valkey: subscribe ack only consumes SUBSCRIPTION_REQUEST promise
robobun Jul 20, 2026
3a43b4f
valkey: drop misleading underscore prefix on pub fields
robobun Jul 20, 2026
9956eec
valkey: only append variant tag for collapsed REDIS_INVALID_RESPONSE
robobun Jul 20, 2026
fd23fa0
valkey: derive SUBSCRIPTION_REQUEST in Meta::check for all send paths
robobun Jul 20, 2026
c28d1a7
valkey: update psubscribe test for subscribe-ack routing behavior
robobun Jul 20, 2026
33266a9
valkey: reword moved stop-gap comments without TODO markers
robobun Jul 20, 2026
8347af7
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 20, 2026
dbf1dd7
valkey: update error-message snapshots for unified require_arg labels
robobun Jul 20, 2026
836f27d
valkey: drop is_subscriber assert on trailing unsubscribe ack; prune …
robobun Jul 20, 2026
517a121
valkey: add SSUBSCRIBE/SUNSUBSCRIBE to auto-pipeline disallow set
robobun Jul 20, 2026
a1df82d
valkey: psubscribe/ssubscribe acks do not enter subscriber mode
robobun Jul 20, 2026
77fc987
valkey: reject cached connectionPromise when reconnect's connect() fails
robobun Jul 20, 2026
f7eebbb
valkey: condense subscribe-ack comment; cover SSUBSCRIBE sibling in n…
robobun Jul 20, 2026
d06d67b
[autofix.ci] apply automated fixes
autofix-ci[bot] Jul 20, 2026
edb5524
valkey: gate subscriber-mode entry on handler-map count, not ack kind
robobun Jul 20, 2026
9a44e8d
Merge origin/main into farm/edd33c02/harden-redis-lifecycle
robobun Jul 21, 2026
a90e1e2
Merge remote-tracking branch 'origin/main' into farm/edd33c02/harden-…
robobun Jul 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions docs/runtime/redis.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ Common error codes:
- `ERR_REDIS_CONNECTION_CLOSED` - Connection to the server was closed
- `ERR_REDIS_AUTHENTICATION_FAILED` - Failed to authenticate with the server
- `ERR_REDIS_INVALID_RESPONSE` - Received an invalid response from the server
- `ERR_REDIS_SERVER_ERROR` - The Redis server returned an error reply

---

Expand Down
29 changes: 29 additions & 0 deletions src/collections/linear_fifo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,15 @@ impl<T, B: LinearFifoBuffer<T>> LinearFifo<T, B> {
}
}

/// Iterate every readable element in FIFO order across both halves of a
/// possibly-wrapped ring. `readable_slice(0)` alone yields only the first
/// contiguous segment.
pub fn iter(&self) -> impl Iterator<Item = &T> {
let first = self.readable_slice(0);
let second = self.readable_slice(first.len());
first.iter().chain(second.iter())
}

/// Discard first `count` items in the fifo
pub fn discard(&mut self, count: usize) {
debug_assert!(count <= self.count);
Expand Down Expand Up @@ -1098,6 +1107,26 @@ mod tests {
assert_eq!(expected, vec![200, 201, 202, 203, 204, 206, 207]);
}

#[test]
fn iter_visits_both_halves_of_wrapped_ring() {
Comment thread
robobun marked this conversation as resolved.
let mut fifo = WrapFifo::init();
for v in 0..12 {
fifo.write_item(v).unwrap();
}
for _ in 0..8 {
fifo.read_item().unwrap();
}
for v in 100..110 {
fifo.write_item(v).unwrap();
}
assert!(fifo.buf_len() - fifo.head < fifo.count, "must be wrapped");
assert!(fifo.readable_slice(0).len() < fifo.readable_length());

let got: Vec<i32> = fifo.iter().copied().collect();
assert_eq!(got, fifo_to_vec(&fifo));
assert_eq!(got.len(), fifo.readable_length());
}

// Exhaustively remove every valid offset from a wrapped layout and compare
// against a reference `Vec`. Uses a fresh FIFO per offset (remove mutates).
#[test]
Expand Down
4 changes: 1 addition & 3 deletions src/jsc/bindings/ErrorCode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,16 +292,14 @@ const errors: ErrorCodeMapping = [
["ERR_REDIS_CONNECTION_TIMEOUT", Error, "RedisError"],
["ERR_REDIS_IDLE_TIMEOUT", Error, "RedisError"],
["ERR_REDIS_INVALID_ARGUMENT", Error, "RedisError"],
["ERR_REDIS_INVALID_ARRAY", Error, "RedisError"],
["ERR_REDIS_INVALID_BULK_STRING", Error, "RedisError"],
["ERR_REDIS_INVALID_COMMAND", Error, "RedisError"],
["ERR_REDIS_INVALID_DATABASE", Error, "RedisError"],
["ERR_REDIS_INVALID_ERROR_STRING", Error, "RedisError"],
["ERR_REDIS_INVALID_INTEGER", Error, "RedisError"],
["ERR_REDIS_INVALID_PASSWORD", Error, "RedisError"],
["ERR_REDIS_INVALID_RESPONSE", Error, "RedisError"],
["ERR_REDIS_INVALID_RESPONSE_TYPE", Error, "RedisError"],
["ERR_REDIS_INVALID_SIMPLE_STRING", Error, "RedisError"],
["ERR_REDIS_SERVER_ERROR", Error, "RedisError"],
Comment thread
robobun marked this conversation as resolved.
["ERR_REDIS_INVALID_STATE", Error, "RedisError"],
["ERR_REDIS_INVALID_USERNAME", Error, "RedisError"],
["ERR_REDIS_TLS_NOT_AVAILABLE", Error, "RedisError"],
Expand Down
17 changes: 1 addition & 16 deletions src/runtime/api/BunObject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ use crate::api::{HashObject, JSON5Object, TOMLObject, UnsafeObject, YAMLObject};
use crate::crypto as Crypto;
use crate::node;
use crate::test_runner::jest::Jest;
use crate::valkey_jsc::js_valkey::SubscriptionCtx;
use bun_core::zig_string::Slice as ZigStringSlice;
use bun_jsc::ZigStringJsc as _; // to_error_instance / to_type_error_instance
use bun_jsc::call_frame::ArgumentsSlice;
Expand Down Expand Up @@ -2025,21 +2024,7 @@ pub(crate) fn get_valkey_default_client(global_this: &JSGlobalObject, _: &JSObje
};

let as_js = JSValkeyClient::ptr_to_js(valkey, global_this);

// SAFETY: `valkey` is a fresh heap allocation owned by the JS wrapper; we
// hold the only reference for field init below.
let valkey_ref = unsafe { &*valkey };
valkey_ref.this_value.set(jsc::JsRef::init_weak(as_js));
match SubscriptionCtx::init(valkey_ref) {
Ok(ctx) => valkey_ref._subscription_ctx.set(ctx),
Err(jsc::JsError::Thrown) | Err(jsc::JsError::Terminated) => return JSValue::ZERO,
Err(err) => {
let _ =
global_this.throw_error(crate::Error::from(err), "Failed to create Redis client");
return JSValue::ZERO;
}
}

JSValkeyClient::bind_js(valkey, as_js);
as_js
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use bun_collections::linear_fifo::{DynamicBuffer, LinearFifo};
use bun_jsc::{self as jsc, JSGlobalObject, JSValue, JsResult};
use bun_jsc::{self as jsc, JSGlobalObject, JSValue};
use bun_valkey::valkey_protocol as protocol;
use bun_valkey::valkey_protocol::RedisError;

use super::protocol_jsc::{ToJSOptions, resp_value_to_js_with_options};

type Slice = bun_core::ZigStringSlice;

// Note: callers in `js_valkey_functions.rs` construct
// `Vec<crate::node::types::BlobOrStringOrBuffer>` directly, so `Args::Args` must accept
// `Vec<crate::node::types::BlobOrStringOrBuffer>` directly, so `Args::Blobs` must accept
// that exact type. The upstream `bun_jsc::Node::BlobOrStringOrBuffer` re-export is a
// stub; use the real in-crate definition (which already provides `slice()` /
// `byte_length()`).
Expand Down Expand Up @@ -35,7 +36,7 @@ impl<'a> Default for Command<'a> {
#[derive(Copy, Clone)]
pub enum Args<'a> {
Slices(&'a [Slice]),
Args(&'a [BlobOrStringOrBuffer]),
Blobs(&'a [BlobOrStringOrBuffer]),
Raw(&'a [&'a [u8]]),
}

Expand All @@ -49,45 +50,49 @@ impl<'a> Args<'a> {
pub(crate) fn len(&self) -> usize {
match self {
Args::Slices(args) => args.len(),
Args::Args(args) => args.len(),
Args::Blobs(args) => args.len(),
Args::Raw(args) => args.len(),
}
}
}

impl<'a> Command<'a> {
pub fn write(&self, writer: &mut impl bun_io::Write) -> Result<(), crate::Error> {
// Serialize as RESP array format directly
write!(writer, "*{}\r\n", 1 + self.args.len())?;
write!(writer, "${}\r\n", self.command.len())?;
writer.write_all(self.command)?;
writer.write_all(b"\r\n")?;

match &self.args {
Args::Slices(args) => {
for arg in args.iter() {
let bytes = arg.slice();
write!(writer, "${}\r\n", bytes.len())?;
writer.write_all(bytes)?;
writer.write_all(b"\r\n")?;
pub fn write(&self, writer: &mut impl bun_io::Write) -> Result<(), RedisError> {
// Serialize as RESP array format directly; `bun_io::Write` can only
// fail with an allocator error, so collapse to `OutOfMemory`.
(|| -> bun_io::Result<()> {
write!(writer, "*{}\r\n", 1 + self.args.len())?;
write!(writer, "${}\r\n", self.command.len())?;
writer.write_all(self.command)?;
writer.write_all(b"\r\n")?;

match &self.args {
Args::Slices(args) => {
for arg in args.iter() {
let bytes = arg.slice();
write!(writer, "${}\r\n", bytes.len())?;
writer.write_all(bytes)?;
writer.write_all(b"\r\n")?;
}
}
}
Args::Args(args) => {
for arg in args.iter() {
write!(writer, "${}\r\n", arg.byte_length())?;
writer.write_all(arg.slice())?;
writer.write_all(b"\r\n")?;
Args::Blobs(args) => {
for arg in args.iter() {
write!(writer, "${}\r\n", arg.byte_length())?;
writer.write_all(arg.slice())?;
writer.write_all(b"\r\n")?;
}
}
}
Args::Raw(args) => {
for arg in args.iter() {
write!(writer, "${}\r\n", arg.len())?;
writer.write_all(arg)?;
writer.write_all(b"\r\n")?;
Args::Raw(args) => {
for arg in args.iter() {
write!(writer, "${}\r\n", arg.len())?;
writer.write_all(arg)?;
writer.write_all(b"\r\n")?;
}
}
}
}
Ok(())
Ok(())
})()
.map_err(|_| RedisError::OutOfMemory)
}

pub fn byte_length(&self) -> usize {
Expand All @@ -97,7 +102,7 @@ impl<'a> Command<'a> {
counter.count
}

pub fn serialize(&self) -> Result<Box<[u8]>, crate::Error> {
pub fn serialize(&self) -> Result<Box<[u8]>, RedisError> {
let mut buf: Vec<u8> = Vec::with_capacity(self.byte_length());
self.write(&mut buf)?;
Ok(buf.into_boxed_slice())
Expand All @@ -107,24 +112,16 @@ impl<'a> Command<'a> {
/// Command stored in offline queue when disconnected
pub struct Entry {
pub serialized_data: Box<[u8]>, // Pre-serialized RESP protocol bytes
pub meta: Meta,
pub promise: Promise,
}

// Inherent associated
// types are unstable on stable Rust, so expose as a sibling module alias instead.
pub mod entry {
pub(crate) type Queue = super::LinearFifo<super::Entry, super::DynamicBuffer<super::Entry>>;
}
pub(crate) type EntryQueue = LinearFifo<Entry, DynamicBuffer<Entry>>;

impl Entry {
// Create an Offline by serializing the Valkey command directly
pub fn create(command: &Command<'_>, promise: Promise) -> Result<Entry, crate::Error> {
pub fn create(command: &Command<'_>, promise: Promise) -> Result<Entry, RedisError> {
Ok(Entry {
serialized_data: command.serialize()?,
// We should be calling .check against command here but due
// to a hack introduced to let SUBSCRIBE work, we are not doing that for now.
meta: command.meta,
promise,
})
}
Expand Down Expand Up @@ -166,18 +163,49 @@ bun_core::comptime_string_set! {
b"PIPELINE",
b"SUBSCRIBE",
b"PSUBSCRIBE",
b"SSUBSCRIBE",
b"UNSUBSCRIBE",
b"UNPSUBSCRIBE",
b"PUNSUBSCRIBE",
b"SUNSUBSCRIBE",
};
Comment thread
robobun marked this conversation as resolved.
}

bun_core::comptime_string_set! {
/// Commands whose reply is a subscribe/unsubscribe ack push rather than a
/// normal in-line reply; their promise must carry SUBSCRIPTION_REQUEST so
/// the push handler knows which in-flight entry to consume.
static SUBSCRIPTION_COMMANDS = {
b"SUBSCRIBE",
b"PSUBSCRIBE",
b"SSUBSCRIBE",
b"UNSUBSCRIBE",
b"PUNSUBSCRIBE",
b"SUNSUBSCRIBE",
};
}

impl Meta {
pub fn check(self, command: &Command<'_>) -> Self {
pub fn check(self, command_name: &[u8]) -> Self {
let mut new = self;
// Case-insensitive probe: all disallowed entries are ≤12 bytes, so any
// name longer than our 32-byte scratch cannot match and can skip the copy.
let mut upper = [0u8; 32];
let n = command_name.len().min(32);
for i in 0..n {
upper[i] = command_name[i].to_ascii_uppercase();
}
let probe: &[u8] = if command_name.len() <= 32 {
&upper[..n]
} else {
command_name
};
new.set(
Meta::SUPPORTS_AUTO_PIPELINING,
!AUTO_PIPELINE_DISALLOWED_COMMANDS.contains(command.command),
!AUTO_PIPELINE_DISALLOWED_COMMANDS.contains(probe),
);
if SUBSCRIPTION_COMMANDS.contains(probe) {
new.insert(Meta::SUBSCRIPTION_REQUEST);
}
new
}
}
Expand All @@ -188,6 +216,8 @@ pub struct Promise {
pub promise: jsc::JSPromiseStrong,
}

pub(crate) type PromiseQueue = LinearFifo<Promise, DynamicBuffer<Promise>>;

impl Promise {
pub fn create(global_object: &JSGlobalObject, meta: Meta) -> Promise {
let promise = jsc::JSPromiseStrong::init(global_object);
Expand All @@ -197,16 +227,21 @@ impl Promise {
pub fn resolve(
&mut self,
global_object: &JSGlobalObject,
value: &mut protocol::RESPValue,
mut value: protocol::RESPValue,
) -> Result<(), jsc::JsTerminated> {
if self.meta.contains(Meta::RETURN_AS_BOOL) {
if let protocol::RESPValue::Integer(int_value) = value {
value = protocol::RESPValue::Boolean(int_value > 0);
}
}
let options = ToJSOptions {
return_as_buffer: self.meta.contains(Meta::RETURN_AS_BUFFER),
};

let js_value = match resp_value_to_js_with_options(value, global_object, options) {
Ok(v) => v,
Err(err) => {
self.reject(global_object, Ok(global_object.take_error(err)))?;
self.promise.reject(global_object, Err(err))?;
return Ok(());
}
};
Expand All @@ -217,32 +252,9 @@ impl Promise {
pub fn reject(
&mut self,
global_object: &JSGlobalObject,
jsvalue: JsResult<JSValue>,
) -> Result<(), jsc::JsTerminated> {
self.promise.reject(global_object, jsvalue)?;
Ok(())
}
}

// Command+Promise pair for tracking which command corresponds to which promise
pub struct PromisePair {
pub meta: Meta,
pub promise: Promise,
}

// See `entry` note above.
pub mod promise_pair {
pub(crate) type Queue =
super::LinearFifo<super::PromisePair, super::DynamicBuffer<super::PromisePair>>;
}

impl PromisePair {
pub fn reject_command(
&mut self,
global_object: &JSGlobalObject,
jsvalue: JSValue,
value: JSValue,
) -> Result<(), jsc::JsTerminated> {
self.promise.reject(global_object, Ok(jsvalue))?;
self.promise.reject(global_object, Ok(value))?;
Ok(())
}
}
21 changes: 0 additions & 21 deletions src/runtime/valkey_jsc/index.rs

This file was deleted.

Loading
Loading