1
1
#pragma once
2
2
#include " AudioTools/CoreAudio/Buffers.h"
3
3
4
+ #define REDIS_RESULT_BUFFER_SIZE (10 * 1024 )
5
+
6
+
4
7
namespace audio_tools {
5
8
6
9
/* *
@@ -282,7 +285,7 @@ class RedisBuffer : public BaseBuffer<T> {
282
285
RedisResult readResponse () {
283
286
RedisResult result;
284
287
result.ok = true ;
285
- uint8_t buffer[1024 ] = {};
288
+ uint8_t buffer[REDIS_RESULT_BUFFER_SIZE ] = {};
286
289
int n = 0 ;
287
290
while (n <= 0 ) {
288
291
n = client.read (buffer, sizeof (buffer));
@@ -375,8 +378,10 @@ class RedisBuffer : public BaseBuffer<T> {
375
378
*/
376
379
void fillReadBuffer () {
377
380
read_buf.reset ();
381
+ int size = read_buf.size ();
382
+ LOGI (" Redis LPOP: %d" , size)
378
383
// 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));
380
385
auto rc = sendCommand (cmd);
381
386
if (!rc.ok ) {
382
387
LOGE (" Redis LPOP failed: %s" , cmd.c_str ());
@@ -386,10 +391,14 @@ class RedisBuffer : public BaseBuffer<T> {
386
391
if (str.startsWith (" *" )) continue ;
387
392
if (str.startsWith (" $" )) continue ;
388
393
if (str.length () == 0 ) continue ;
389
- LOGI (" Redis LPOP: %s" , str.c_str ());
394
+ LOGI (" - %s" , str.c_str ());
390
395
T value = (T)str.toInt ();
391
396
read_buf.write (value);
392
397
}
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 () );
393
402
}
394
403
};
395
404
0 commit comments