-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Fix/delay first messages #82
Conversation
WalkthroughThe changes in the pull request focus on the Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Outside diff range and nitpick comments (1)
src/jobs/webhooker.ts (1)
26-26
: Redundant use ofMath.floor
withDate.now()
The
Date.now()
function returns an integer representing the number of milliseconds since the epoch. ApplyingMath.floor
is unnecessary sinceDate.now()
already returns an integer.You can simplify the code by removing
Math.floor
.Apply this diff:
- const epochMS: number = Math.floor(Date.now()); + const epochMS: number = Date.now();
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
- src/jobs/webhooker.ts (2 hunks)
🧰 Additional context used
🪛 Biome
src/jobs/webhooker.ts
[error] 8-8: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
[error] 9-9: Don't use 'String' as a type.
Use lowercase primitives for consistency.
Safe fix: Use 'string' instead(lint/complexity/noBannedTypes)
🔇 Additional comments (2)
src/jobs/webhooker.ts (2)
35-35
: Possible negative delay inthisMessageDelay
calculationWhen calculating
thisMessageDelay
usingnextMessageTime - epochMS
, there is a possibility thatthisMessageDelay
becomes negative ifnextMessageTime
is less thanepochMS
. Although the subsequentif
condition checks forthisMessageDelay > 0
, it's good practice to ensure that delay values are not negative.Please verify that
nextMessageTime
is always greater than or equal toepochMS
, or adjust the logic to handle negative delays appropriately.
Line range hint
13-43
: Overall logic and implementation look goodThe updated
delayFunc
implementation enhances the delay handling mechanism effectively. The use of maps to trackdUntil
anddVerified
improves control over message delays based on timestamps.
Summary by CodeRabbit
New Features
Bug Fixes