RediStack icon indicating copy to clipboard operation
RediStack copied to clipboard

fix: bugs in zpopmin/zpopmax;

Open iwecon opened this issue 2 months ago • 1 comments

Details: #135

Because zadd defaults to (RESPValue, Double), scoreIsFirst is set to false by default.

zadd function:

@inlinable
public func zadd<Value: RESPValueConvertible>(
    _ elements: [(element: Value, score: Double)],
    to key: RedisKey,
    inserting insertBehavior: RedisZaddInsertBehavior = .allElements,
    returning returnBehavior: RedisZaddReturnBehavior = .insertedElementsCount
) -> EventLoopFuture<Int> {
    var args: [RESPValue] = [.init(from: key)]

    args.append(convertingContentsOf: [insertBehavior.string, returnBehavior.string].compactMap({ $0 }))
    args.add(contentsOf: elements, overestimatedCountBeingAdded: elements.count * 2) { (array, next) in
        array.append(.init(bulk: next.score.description))
        array.append(next.element.convertedToRESPValue())
    }

    return self.send(command: "ZADD", with: args)
        .tryConverting()
}

iwecon avatar Dec 08 '25 19:12 iwecon

@fabianfett @0xTim pls review! :)

iwecon avatar Dec 08 '25 19:12 iwecon

Has this project been forgotten? @Joannis @fabianfett @Mordil

iwecon avatar Jan 16 '26 05:01 iwecon

@iwecon it's been superceded by the official Valkey client: https://github.com/valkey-io/valkey-swift Valkey is the OpenSource fork of Redis powered by the Linux Foundation, highly recommend you use thhat library going forward.

Joannis avatar Jan 16 '26 13:01 Joannis

@iwecon it's been superceded by the official Valkey client: https://github.com/valkey-io/valkey-swift Valkey is the OpenSource fork of Redis powered by the Linux Foundation, highly recommend you use thhat library going forward.

Ah, okay. Is this repository no longer being maintained?

iwecon avatar Jan 16 '26 13:01 iwecon

Ah, okay. Is this repository no longer being maintained?

@iwecon practically yes, however I can merge the changes and do a release for this given it's a small patch

0xTim avatar Jan 16 '26 18:01 0xTim

@iwecon I don't permissions to bypass the checks so you'll need to get CI passing

0xTim avatar Feb 10 '26 13:02 0xTim