Skip to content

Commit

Permalink
Fix(redis): Avoid calling serializer twice (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpolaszek committed Mar 19, 2024
1 parent b0350eb commit c7d78b6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Hub/Transport/Redis/RedisTransport.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function publish(Update $update): PromiseInterface
$promise = $this->redis->publish($this->options['channel'], $payload); // @phpstan-ignore-line

return maybeTimeout($promise, $this->options['readTimeout'])
->then(fn () => $this->store($update))
->then(fn () => $this->store($payload))
->then(fn () => $update);
}

Expand Down Expand Up @@ -113,15 +113,15 @@ public function reconciliate(string $lastEventID): Generator
/**
* @return PromiseInterface<null>
*/
private function store(Update $update): PromiseInterface
private function store(string $payload): PromiseInterface
{
$this->init();
if ($this->options['size'] <= 0) {
return resolve(null);
}

// @phpstan-ignore-next-line
return $this->redis->rpush($this->options['key'], $this->serializer->serialize($update));
return $this->redis->rpush($this->options['key'], $payload);
}

private function init(): void
Expand Down

0 comments on commit c7d78b6

Please sign in to comment.