File size: 356 Bytes
4327358
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import { WAMessageAckBody } from '@waha/structures/webhooks.dto';
import { distinct, interval } from 'rxjs';

export function DistinctAck(flushEvery: number = 60_000) {
  // only if we haven’t seen this key since the last flush
  return distinct(
    (msg: WAMessageAckBody) => `${msg.id}-${msg.ack}-${msg.participant}`,
    interval(flushEvery),
  );
}