Test: live:client hash appears/disappears on V2 auth/disconnect

Add RedisLiveStateTest (2 tests) to test_redis.py verifying that
live:client:<callsign> hashes appear in Redis on V2 client auth and
are deleted on disconnect.

Fix a pre-existing bug in RedisStore where drainLiveQueue() sent HSET/
DEL/EXPIRE commands on m_async — the same hiredis context used for
SUBSCRIBE. Redis rejects non-pub/sub commands on a subscribed connection,
causing the repeated "async disconnect" loop seen in logs. Add a second
async context m_async_write exclusively for live-state writes; the sub
context m_async is now used only for SUBSCRIBE/config.changed delivery.

All 7 Redis integration tests pass.
This commit is contained in:
Audric committed 2026-04-15 11:54:48 +02:00
1 parent 685696b6b2
commit 9ce6211b03
3 files changed
+145 -23

No files matched your search

+4 -1
View File
@@ -82,11 +82,13 @@ class RedisStore : public sigc::trackable
size_t liveQueueSize(void) const;
void onAsyncDisconnect(int status);
void onAsyncWriteDisconnect(int status);
private:
Config m_cfg;
redisContext* m_sync = nullptr;
redisAsyncContext* m_async = nullptr;
redisAsyncContext* m_async = nullptr; // pub/sub subscriber only
redisAsyncContext* m_async_write = nullptr; // live-state writes (HSET/DEL)
RedisAsyncAdapter* m_adapter = nullptr;
RedisLiveQueue* m_live_queue = nullptr;
Async::Timer* m_drain_timer = nullptr;
@@ -99,6 +101,7 @@ class RedisStore : public sigc::trackable
bool connectSync(void);
bool connectAsync(void);
bool connectAsyncWrite(void);
void subscribe(void);
void scheduleReconnect(void);
void onPubSubMessage(const std::string& channel, const std::string& payload);