Timing of sending "REPLCONF GETACK *" for the Redis master server

I am confused about the timing of sending “REPLCONF GETACK *” for the master
should it

  • be sent after the master sends ‘SET’
    or
  • be sent after the master receives the ‘WAIT’ command?

After WAIT :slightly_smiling_face: The logic here would be:

  • Are there enough clients that I’m aware of that have an up-to-date replication offset?
    • if yes, return count right away and don’t send GETACKs.
    • If no, append a GETACK to the replication stream (so ALL replicas will get it), and wait for the ACKs to pour in

Thanks!

Follow up question

My implement now is

  • it won’t send GETACKs after sending SET (for Redis Asynchronous replication), so I don’t know if replica have up-to-date replication offset
  • It will send GETACKs to the replication stream in every WAIT command

My question is

  • how to know have an up-to-date replication offset without sending GETACK to the replication stream?
  • or does it make sense to send GETACKs to the replication stream in every WAIT command?