Fix WebSocket events being silently dropped on buffer overflow (#313)
* Fix WebSocket events being silently dropped on buffer overflow Increases the MutableSharedFlow `extraBufferCapacity` from 64 to 256 and changes the `onBufferOverflow` policy to `BufferOverflow.DROP_OLDEST` in `HermesWsClient.kt`. This fixes an issue where the slow collection (e.g., due to DB writes) caused the buffer to fill up and silently drop incoming real-time WebSocket events. By setting `DROP_OLDEST`, `tryEmit()` remains functional without suspending, allowing real-time events to be retained and prioritized. Fixes #275 * Fix ktlint formatting issues in HermesWsClient.kt The formatting changes adhere to ktlint rules required by the CI pipeline: - Removed a trailing comma in MutableSharedFlow initialization to avoid multiline expression wrapping errors. - Sorted imports to be in lexicographical order. These formatting changes fix the failing CI check. Fixes #275 * Fix WebSocket events being silently dropped on buffer overflow Increases the MutableSharedFlow `extraBufferCapacity` from 64 to 256 and changes the `onBufferOverflow` policy to `BufferOverflow.DROP_OLDEST` in `HermesWsClient.kt`. This fixes an issue where the slow collection (e.g., due to DB writes) caused the buffer to fill up and silently drop incoming real-time WebSocket events. By setting `DROP_OLDEST`, `tryEmit()` remains functional without suspending, allowing real-time events to be retained and prioritized. Fixes #275 * Fix WebSocket events being silently dropped on buffer overflow Increases the MutableSharedFlow extraBufferCapacity from 64 to 256 and changes the onBufferOverflow policy to BufferOverflow.DROP_OLDEST in HermesWsClient.kt. This fixes an issue where the slow collection (e.g., due to DB writes) caused the buffer to fill up and silently drop incoming real-time WebSocket events. By setting DROP_OLDEST, tryEmit() remains functional without suspending, allowing real-time events to be retained and prioritized. Fixes #275 * Fix WebSocket events being silently dropped on buffer overflow Increases the MutableSharedFlow extraBufferCapacity from 64 to 256 and changes the onBufferOverflow policy to BufferOverflow.DROP_OLDEST in HermesWsClient.kt. This fixes an issue where the slow collection (e.g., due to DB writes) caused the buffer to fill up and silently drop incoming real-time WebSocket events. By setting DROP_OLDEST, tryEmit() remains functional without suspending, allowing real-time events to be retained and prioritized. Fixes #275 * Fix WebSocket events being silently dropped on buffer overflow Increases the MutableSharedFlow extraBufferCapacity from 64 to 256 and changes the onBufferOverflow policy to BufferOverflow.DROP_OLDEST in HermesWsClient.kt. This fixes an issue where the slow collection (e.g., due to DB writes) caused the buffer to fill up and silently drop incoming real-time WebSocket events. By setting DROP_OLDEST, tryEmit() remains functional without suspending, allowing real-time events to be retained and prioritized. Fixes #275 --------- Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
2c6e437a5b
commit
eb71ae3a46
41 files changed
+666
-246
No files matched your search
@@ -0,0 +1,56 @@
|
||||
name: Label PR merge conflicts
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened, ready_for_review]
|
||||
|
||||
jobs:
|
||||
label-conflict:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Get PR data and label conflicts
|
||||
uses: actions/github-script@v7
|
||||
with:
|
||||
script: |
|
||||
const pr = context.payload.pull_request;
|
||||
const prNumber = pr.number;
|
||||
const repo = context.repo;
|
||||
|
||||
// Fetch PR details to get mergeable_state
|
||||
const { data: prData } = await github.rest.pulls.get({
|
||||
...repo,
|
||||
pull_number: prNumber
|
||||
});
|
||||
|
||||
const mergeableState = prData.mergeable_state; // clean, dirty, blocked, unstable
|
||||
const hasConflict = mergeableState === 'dirty';
|
||||
|
||||
const labelName = 'merge-conflict';
|
||||
|
||||
// Get current labels
|
||||
const { data: labels } = await github.rest.issues.listLabelsOnIssue({
|
||||
...repo,
|
||||
issue_number: prNumber
|
||||
});
|
||||
const hasLabel = labels.some(l => l.name === labelName);
|
||||
|
||||
if (hasConflict && !hasLabel) {
|
||||
console.log(`PR #${prNumber} has merge conflicts. Adding label '${labelName}'.`);
|
||||
await github.rest.issues.addLabels({
|
||||
...repo,
|
||||
issue_number: prNumber,
|
||||
labels: [labelName]
|
||||
});
|
||||
} else if (!hasConflict && hasLabel) {
|
||||
console.log(`PR #${prNumber} no longer has merge conflicts. Removing label '${labelName}'.`);
|
||||
await github.rest.issues.removeLabel({
|
||||
...repo,
|
||||
issue_number: prNumber,
|
||||
name: labelName
|
||||
});
|
||||
} else {
|
||||
console.log(`PR #${prNumber}: conflict=${hasConflict}, label=${hasLabel}. No change needed.`);
|
||||
}
|
||||
Reference in new issue
Block a user