Skip to content

Commit

Permalink
fix bool expression
Browse files Browse the repository at this point in the history
  • Loading branch information
bytadaniel committed Oct 17, 2023
1 parent d7b6e13 commit 2bd2aaf
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/chunk-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ export class ChunkResolver {
* the system removes it from registry and puts to a resolve queue
*/
async #watchRegistry () {
while (!this.#registry.isEmpty() || this.#commandStop) {
const hasElements = !this.#toResolveQueue.isEmpty()
const hasStopCommand = this.#commandStop

while (hasElements && !hasStopCommand) {
const snapshot = this.#registry.getAll()

for (const state of snapshot) {
Expand Down Expand Up @@ -161,7 +164,10 @@ export class ChunkResolver {
* Resolve is a required process to clenup chunk data from storage (process memory, disk space or cloud)
*/
async #watchToResolveQueue () {
while (!this.#toResolveQueue.isEmpty() || this.#commandStop) {
const hasElements = !this.#toResolveQueue.isEmpty()
const hasStopCommand = this.#commandStop

while (hasElements && !hasStopCommand) {
const chunk = this.#toResolveQueue.dequeue()
if (!chunk) {
continue
Expand Down

0 comments on commit 2bd2aaf

Please sign in to comment.