Skip to content

Commit

Permalink
fix typographical errors and improve code readability (#2483)
Browse files Browse the repository at this point in the history
**This PR includes the following changes:**

1. Fixed typographical error in comment: changed `the` to `to`
2. Improved variable naming consistency for better code readability
3. Increased timeouts in `nightwatch` config to resolve test failures

**Changes made:**
- Fixed comment wording in `hubEventProcessor.ts`
- Updated variable names for consistency in
`validateOrRevokeMessagesJob.ts`
- Increased timeouts and retry attempts in `nightwatch` configuration

<!-- start pr-codex -->

---

## PR-Codex overview
This PR focuses on correcting typos in comments and variable names
related to time allocation in the `pruneMessagesJob.ts` and
`validateOrRevokeMessagesJob.ts` files, ensuring clarity and consistency
in the code.

### Detailed summary
- Corrected the comment in `hubEventProcessor.ts` from "consider" to "to
consider".
- Changed variable name `allotedTimeMs` to `allottedTimeMs` in:
  - `pruneMessagesJob.ts`
  - `validateOrRevokeMessagesJob.ts`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
maximevtush authored Jan 27, 2025
1 parent 574d032 commit cc2c9d9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions apps/hubble/src/storage/jobs/pruneMessagesJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ export class PruneMessagesJobScheduler {
// 2. Don't overload the DB or Sync Trie, causing spikes in latency
if (fid % 100 === 0) {
// See if we are running ahead of schedule
const allotedTimeMs = TIME_SCHEDULED_PER_FID_MS * fid;
const allottedTimeMs = TIME_SCHEDULED_PER_FID_MS * fid;
const elapsedTimeMs = Date.now() - start;
if (allotedTimeMs > elapsedTimeMs) {
const sleepTimeMs = allotedTimeMs - elapsedTimeMs;
if (allottedTimeMs > elapsedTimeMs) {
const sleepTimeMs = allottedTimeMs - elapsedTimeMs;
// Sleep for the remaining time
await sleep(sleepTimeMs);
}
Expand Down
6 changes: 3 additions & 3 deletions apps/hubble/src/storage/jobs/validateOrRevokeMessagesJob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ export class ValidateOrRevokeMessagesJobScheduler {
// Throttle the job.
// We run at the rate of 50 fids per second. If we are running ahead of schedule, we sleep to catch up
if (fid % 100 === 0) {
const allotedTimeMs = (fid - lastFid) * TIME_SCHEDULED_PER_FID_MS;
const allottedTimeMs = (fid - lastFid) * TIME_SCHEDULED_PER_FID_MS;
const elapsedTimeMs = Date.now() - start;
if (allotedTimeMs > elapsedTimeMs) {
const sleepTimeMs = allotedTimeMs - elapsedTimeMs;
if (allottedTimeMs > elapsedTimeMs) {
const sleepTimeMs = allottedTimeMs - elapsedTimeMs;
// Sleep for the remaining time
await sleep(sleepTimeMs);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/shuttle/src/shuttle/hubEventProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export class HubEventProcessor {
return "deleted";
}

// The above are 2p sets, so we have the consider whether they are add or remove messages to determine the state
// The above are 2p sets, so we have to consider whether they are add or remove messages to determine the state
// The rest are 1p sets, so we can just check the operation

return isAdd ? "created" : "deleted";
Expand Down

0 comments on commit cc2c9d9

Please sign in to comment.