Skip to content

Commit 8d81294

Browse files
committed
REDIS_RESULT_BUFFER_SIZE
1 parent 8c613e8 commit 8d81294

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/AudioTools/Communication/RedisBuffer.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#pragma once
22
#include "AudioTools/CoreAudio/Buffers.h"
33

4+
#define REDIS_RESULT_BUFFER_SIZE (10 * 1024)
5+
6+
47
namespace audio_tools {
58

69
/**
@@ -282,7 +285,7 @@ class RedisBuffer : public BaseBuffer<T> {
282285
RedisResult readResponse() {
283286
RedisResult result;
284287
result.ok = true;
285-
uint8_t buffer[1024] = {};
288+
uint8_t buffer[REDIS_RESULT_BUFFER_SIZE] = {};
286289
int n = 0;
287290
while (n <= 0) {
288291
n = client.read(buffer, sizeof(buffer));
@@ -375,8 +378,10 @@ class RedisBuffer : public BaseBuffer<T> {
375378
*/
376379
void fillReadBuffer() {
377380
read_buf.reset();
381+
int size = read_buf.size();
382+
LOGI("Redis LPOP: %d", size)
378383
// Read up to local_buf_size items from Redis
379-
String cmd = redisCommand("LPOP", key, String(read_buf.size()));
384+
String cmd = redisCommand("LPOP", key, String(size));
380385
auto rc = sendCommand(cmd);
381386
if (!rc.ok) {
382387
LOGE("Redis LPOP failed: %s", cmd.c_str());
@@ -386,10 +391,14 @@ class RedisBuffer : public BaseBuffer<T> {
386391
if (str.startsWith("*")) continue;
387392
if (str.startsWith("$")) continue;
388393
if (str.length() == 0) continue;
389-
LOGI("Redis LPOP: %s", str.c_str());
394+
LOGI("- %s", str.c_str());
390395
T value = (T)str.toInt();
391396
read_buf.write(value);
392397
}
398+
399+
LOGI("RedisBuffer: %d of %d items",(int) read_buf.available(),(int) read_buf.size() );
400+
// if this fails the
401+
assert(read_buf.isFull() );
393402
}
394403
};
395404

0 commit comments

Comments
 (0)