@@ -1086,7 +1086,10 @@ class NamespaceFS {
1086
1086
const bytesRead = await file . read ( fs_context , buffer , 0 , read_size , pos ) ;
1087
1087
if ( ! bytesRead ) {
1088
1088
buffer_pool_cleanup = null ;
1089
+ const start_time = performance . now ( ) ;
1089
1090
callback ( ) ;
1091
+ const end_time = performance . now ( ) ;
1092
+ dbg . log2 ( `get_buffer: Time taken to execute callback is ${ end_time - start_time } ms.` ) ;
1090
1093
break ;
1091
1094
}
1092
1095
object_sdk . throw_if_aborted ( ) ;
@@ -1111,15 +1114,22 @@ class NamespaceFS {
1111
1114
1112
1115
// wait for response buffer to drain before adding more data if needed -
1113
1116
// this occurs when the output network is slower than the input file
1117
+ const start_time_drain_promise = performance . now ( ) ;
1114
1118
if ( drain_promise ) {
1119
+ dbg . log2 ( 'iniside condition: drain_promise' ) ;
1115
1120
await drain_promise ;
1116
1121
drain_promise = null ;
1117
1122
object_sdk . throw_if_aborted ( ) ;
1118
1123
}
1124
+ const end_time_drain_promise = performance . now ( ) ;
1125
+ dbg . log2 ( `drain_promise: Time taken to execute is ${ end_time_drain_promise - start_time_drain_promise } ms.` ) ;
1119
1126
1120
1127
// write the data out to response
1121
1128
buffer_pool_cleanup = null ; // cleanup is now in the socket responsibility
1129
+ const start_time_write = performance . now ( ) ;
1122
1130
const write_ok = res . write ( data , null , callback ) ;
1131
+ const end_time_write = performance . now ( ) ;
1132
+ dbg . log2 ( `write to socket: Time taken to execute is ${ end_time_write - start_time_write } ms.` ) ;
1123
1133
if ( ! write_ok ) {
1124
1134
drain_promise = stream_utils . wait_drain ( res , { signal : object_sdk . abort_controller . signal } ) ;
1125
1135
drain_promise . catch ( ( ) => undefined ) ; // this avoids UnhandledPromiseRejection
@@ -1132,6 +1142,7 @@ class NamespaceFS {
1132
1142
1133
1143
// wait for the last drain if pending.
1134
1144
if ( drain_promise ) {
1145
+ dbg . log2 ( 'iniside condition2 (last drain): drain_promise' ) ;
1135
1146
await drain_promise ;
1136
1147
drain_promise = null ;
1137
1148
object_sdk . throw_if_aborted ( ) ;
0 commit comments