File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -818,7 +818,12 @@ export class Actor<Data extends Dictionary = Dictionary> {
818
818
819
819
this . _ensureActorInit ( 'openRequestQueue' ) ;
820
820
821
- return this . _openStorage ( RequestQueue , queueIdOrName , options ) ;
821
+ const queue = await this . _openStorage ( RequestQueue , queueIdOrName , options ) ;
822
+
823
+ // eslint-disable-next-line dot-notation
824
+ queue [ 'initialCount' ] = ( await queue . client . get ( ) ) ?. totalRequestCount ?? 0 ;
825
+
826
+ return queue ;
822
827
}
823
828
824
829
/**
Original file line number Diff line number Diff line change @@ -604,10 +604,15 @@ describe('Actor', () => {
604
604
const queueId = 'abc' ;
605
605
const options = { forceCloud : true } ;
606
606
const openStorageSpy = vitest . spyOn ( StorageManager . prototype , 'openStorage' ) ;
607
- openStorageSpy . mockImplementationOnce ( async ( i ) => i ) ;
608
- await sdk . openRequestQueue ( queueId , options ) ;
607
+
608
+ const mockRQ = { client : { get : ( ) => ( { totalRequestCount : 10 } ) } } ;
609
+
610
+ openStorageSpy . mockImplementationOnce ( async ( ) => mockRQ ) ;
611
+ const queue = await sdk . openRequestQueue ( queueId , options ) ;
609
612
expect ( openStorageSpy ) . toBeCalledWith ( queueId , sdk . apifyClient ) ;
610
613
expect ( openStorageSpy ) . toBeCalledTimes ( 1 ) ;
614
+
615
+ expect ( queue . initialCount ) . toBe ( 10 ) ;
611
616
} ) ;
612
617
613
618
test ( 'openDataset should open storage' , async ( ) => {
You can’t perform that action at this time.
0 commit comments