- if (rioWriteBulkCount(r,'*',3) == 0) return 0;
- if (rioWriteBulkString(r,"RPUSH",5) == 0) return 0;
- if (rioWriteBulkObject(r,key) == 0) return 0;
+ if (count == 0) {
+ int cmd_items = (items > REDIS_AOFREWRITE_ITEMS_PER_CMD) ?
+ REDIS_AOFREWRITE_ITEMS_PER_CMD : items;
+ if (rioWriteBulkCount(r,'*',2+cmd_items) == 0) return 0;
+ if (rioWriteBulkString(r,"RPUSH",5) == 0) return 0;
+ if (rioWriteBulkObject(r,key) == 0) return 0;
+ }