Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: remove broadcastTalkReq #282

Merged
merged 1 commit into from
Jan 19, 2024
Merged

Conversation

wemeetagain
Copy link
Member

BREAKING CHANGE:
broadcastTalkReq has been removed since it was very opinionated and can be trivially reproduced using kadValues and sendTalkReq.

function broadcastTalkReq(
  discv5: IDiscv5, payload: Buffer, protocol: string | Uint8Array
): Promise<Buffer> {
  const requests = []
  for (const enr of discv5.kadValues()) {
    requests.push(discv5.sendTalkReq(enr, payload, protocol)
  }
  // Depending on the use case
  // you might want to replace with Promise.allSettled
  // to return all responses / errors
  return Promise.race(requests)
}

BREAKING CHANGE:
`broadcastTalkReq` has been removed since it was very opinionated and
can be trivially reproduced using `kadValues` and `sendTalkReq`.

```ts
function broadcastTalkReq(
  discv5: IDiscv5, payload: Buffer, protocol: string | Uint8Array
): Promise<Buffer> {
  const requests = []
  for (const enr of discv5.kadValues()) {
    requests.push(discv5.sendTalkReq(enr, payload, protocol)
  }
  // Depending on the use case
  // you might want to replace with Promise.allSettled
  // to return all responses / errors
  return Promise.race(requests)
}
```
@wemeetagain wemeetagain requested a review from a team as a code owner January 19, 2024 20:31
@wemeetagain wemeetagain merged commit 1b70558 into master Jan 19, 2024
6 checks passed
@wemeetagain wemeetagain deleted the cayman/remove-broadcast-talk-req branch January 19, 2024 20:33
@github-actions github-actions bot mentioned this pull request Jan 19, 2024
@github-actions github-actions bot mentioned this pull request Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant