cjoki
cjoki

Reputation: 1

need to resovle Predis "ERR syntax error"

I made a back-end app based on Predis, PHP, Redis Local development was done with Redis 6.x and works great. This code is used for logging messages from other executing code to a remote Redis server where a worker will consume the stream data and move it into MySQL for longer term storage.

Moving the code into our dev server for testing I started getting "ERR syntax error". After some digging I found dev was running Redis 5.x. So we upgraded to Redis 7.x. The code was still reporting the same error. I ending up changing the code to use different Redis command and it worked when sending

    /**
     * return data on the status of streams
     *
     * @return array
     */
    public function findPending() {
        // XPENDING hubCurlLog hubCurlLog-group IDLE 9000 - + 1  hubCurlLog-group_1
        $command = ['XPENDING', $this->stream_name, $this->stream_group_name, 'IDLE', 9000, '-', '+', 1, $this->consumer_name];
        return $this->redis_client->executeRaw($command);
    }

The function above will produce a Redis command like

XPENDING hubCurlLog hubCurlLog-group IDLE 9000 - + 1 hubCurlLog-group_1

which is where I am getting the ERR syntax error

If I run the Redis command in the cli I still get the same error but I do see the hint when typing in the command that it is known. redis-cli command hint

How do I get past this syntax issue?

Upvotes: 0

Views: 583

Answers (1)

cjoki
cjoki

Reputation: 1

I found a work around that looks to work, I removed the IDLE and time

from

XPENDING hubCurlLog hubCurlLog-group IDLE 9000 - + 1 hubCurlLog-group_1

to

XPENDING hubCurlLog hubCurlLog-group - + 1 hubCurlLog-group_1

Upvotes: 0

Related Questions