File tree Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -880,8 +880,21 @@ class ReadableCursorStream extends Readable {
880
880
}
881
881
882
882
private _readNext ( ) {
883
- callbackify ( next ) ( this . _cursor , true , ( err , result ) => {
884
- if ( err ) {
883
+ next ( this . _cursor , true ) . then (
884
+ result => {
885
+ if ( result == null ) {
886
+ this . push ( null ) ;
887
+ } else if ( this . destroyed ) {
888
+ this . _cursor . close ( ) . catch ( ( ) => null ) ;
889
+ } else {
890
+ if ( this . push ( result ) ) {
891
+ return this . _readNext ( ) ;
892
+ }
893
+
894
+ this . _readInProgress = false ;
895
+ }
896
+ } ,
897
+ err => {
885
898
// NOTE: This is questionable, but we have a test backing the behavior. It seems the
886
899
// desired behavior is that a stream ends cleanly when a user explicitly closes
887
900
// a client during iteration. Alternatively, we could do the "right" thing and
@@ -910,18 +923,6 @@ class ReadableCursorStream extends Readable {
910
923
// See NODE-4475.
911
924
return this . destroy ( err ) ;
912
925
}
913
-
914
- if ( result == null ) {
915
- this . push ( null ) ;
916
- } else if ( this . destroyed ) {
917
- this . _cursor . close ( ) . catch ( ( ) => null ) ;
918
- } else {
919
- if ( this . push ( result ) ) {
920
- return this . _readNext ( ) ;
921
- }
922
-
923
- this . _readInProgress = false ;
924
- }
925
- } ) ;
926
+ ) ;
926
927
}
927
928
}
You can’t perform that action at this time.
0 commit comments