anchor.diff:  -define(MAX_DOWNLOAD_BUFFER_SIZE, application:get_env(
       ?APP_NAME, max_download_buffer_size, 20971520) % 20 MB
   ).
  --define(SEND_RETRY_DELAY, 100).
  +
  +% TODO VFS-6597 - update cowboy to at least ver 2.7 to fix streaming big files
  +% Due to lack of backpressure mechanism in cowboy when streaming files it must
  +% be additionally implemented. This module implementation checks cowboy process
  +% msg queue len to see if next data chunk can be queued. To account for
  +% differences in speed between network and storage a simple backoff is
  +% implemented with below boundaries.
  +-define(MIN_SEND_RETRY_DELAY, 100).
  +-define(MAX_SEND_RETRY_DELAY, 1000).
   
   
   %%%===================================================================
  
positive.code: %% read into memory.
  %% @end
  %%--------------------------------------------------------------------
  send_data(Data, #{pid := ConnPid} = Req, MaxReadBlocks) ->
      {message_queue_len, MsgQueueLen} = process_info(ConnPid, message_queue_len),
  
      case MsgQueueLen < MaxReadBlocks of
          true ->
              cowboy_req:stream_body(Data, nofin, Req);
          false ->
              timer:sleep(?SEND_RETRY_DELAY),
              send_data(Data, Req, MaxReadBlocks)
      end.
  
negative.code:     ok | no_return().
  stream_range(FileHandle, Range, Req, EncodingFun, ReadBlockSize) ->
      MaxReadBlocks = max(1, ?MAX_DOWNLOAD_BUFFER_SIZE div ReadBlockSize),
      stream_range(
          FileHandle, Range, Req, EncodingFun,
          ReadBlockSize, MaxReadBlocks, ?MIN_SEND_RETRY_DELAY
      ).
  
  
  %%%===================================================================
  