@@ -359,7 +359,7 @@ export class AsyncQueuer<TValue> {
359359 const activeItems = this . store . state . activeItems
360360 while (
361361 activeItems . length < this . #getConcurrency( ) &&
362- ! this . store . state . isEmpty
362+ this . store . state . items . length > 0
363363 ) {
364364 const nextItem = this . peekNextItem ( )
365365 if ( ! nextItem ) {
@@ -402,7 +402,7 @@ export class AsyncQueuer<TValue> {
402402 position : QueuePosition = this . options . addItemsTo ?? 'back' ,
403403 runOnItemsChange : boolean = true ,
404404 ) : boolean => {
405- if ( this . store . state . isFull ) {
405+ if ( this . store . state . items . length >= ( this . options . maxSize ?? Infinity ) ) {
406406 this . #setState( {
407407 rejectionCount : this . store . state . rejectionCount + 1 ,
408408 } )
@@ -578,7 +578,7 @@ export class AsyncQueuer<TValue> {
578578 const expiredIndices : Array < number > = [ ]
579579
580580 // Find indices of expired items
581- for ( let i = 0 ; i < this . store . state . size ; i ++ ) {
581+ for ( let i = 0 ; i < this . store . state . items . length ; i ++ ) {
582582 const timestamp = this . store . state . itemTimestamps [ i ]
583583 if ( timestamp === undefined ) continue
584584
@@ -633,7 +633,7 @@ export class AsyncQueuer<TValue> {
633633 if ( position === 'front' ) {
634634 return this . store . state . items [ 0 ]
635635 }
636- return this . store . state . items [ this . store . state . size - 1 ]
636+ return this . store . state . items [ this . store . state . items . length - 1 ]
637637 }
638638
639639 /**
@@ -662,7 +662,7 @@ export class AsyncQueuer<TValue> {
662662 */
663663 start = ( ) : void => {
664664 this . #setState( { isRunning : true } )
665- if ( ! this . store . state . pendingTick && ! this . store . state . isEmpty ) {
665+ if ( ! this . store . state . pendingTick && this . store . state . items . length > 0 ) {
666666 this . #tick( )
667667 }
668668 }
0 commit comments