schwa / RedisConnection

A Swift Concurrency based implementation of the Redis Protocol
BSD 3-Clause "New" or "Revised" License
13 stars 3 forks source link

Assertion failure while subscribing #1

Closed PPunya closed 1 month ago

PPunya commented 1 month ago

In RedisConnection actor, when mode is .subscriber, it calls sendNoReceive and there it demands the mode to be .normal. Could we have it asserted as mode == .subscriber within sendNoReceive(value: RESPValue) and receive()?

    func subscribe(channels: String...) async throws -> AnyAsyncSequence<Pubsub> {
 1.       mode = .subscriber

        logger?.debug("\(#function)")
2.        try await sendNoReceive(value: ["SUBSCRIBE"] + channels)

    func sendNoReceive(value: [String]) async throws {
 3.       try await sendNoReceive(value: value)

    public func sendNoReceive(value: RESPValue) async throws {
4.        assert(mode == .normal)

Thanks.

schwa commented 1 month ago

I'm not actively developing this project.

I'll take a look at any PR though.

PPunya commented 1 month ago

Sure.