Commit ae4aea19 authored by Yuanle Song's avatar Yuanle Song
Browse files

v1.2.7.0 don't print "No block fetched in last 10 seconds" when

all blocks are fetched.
parent ae736748
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -492,9 +492,6 @@ via env var and command line parameter.

* current                                                             :entry:
** 
** 2024-04-07 when combining blocks to create final file, don't print
"No block fetched in last 10 seconds" log any more if there is no other files
in DL list.
** 2024-04-07 rd-api: when a file content is changed on disk, auto invalidate all
cached blocks.

@@ -537,6 +534,12 @@ policy in ovs can do it.
  see stretch01 daylog.

* done                                                                :entry:
** 2024-04-25 haskell: when only executable code changes, should I in increase version in package.yaml
I think I will defer version change to avoid re-compilation of the base library.

** 2024-04-07 when combining blocks to create final file, don't print
"No block fetched in last 10 seconds" log any more if there is no other files
in DL list.
** 2024-04-24 try build this project in gocd.
- build in debian stretch agent node.
- build in docker is fine.
+2 −0
Original line number Diff line number Diff line
name:                reliable-download
# do not modify version if lib/ code is not changed.
# real app version: 1.2.7.0
version:             1.2.6.0
synopsis:            provide reliable download service via HTTP
description:         reliable-download web application and cli tool
+4 −0
Original line number Diff line number Diff line
@@ -72,6 +72,10 @@ https://gitlab.emacsos.com/sylecn/reliable-download
ChangeLog
---------

* dev

  - bugfix: don't print no block fetched in last N seconds when all blocks are fetched.

* v1.5.0.0 2024-04-08

  - bugfix: properly handle unicode string in URL path
+16 −7
Original line number Diff line number Diff line
@@ -82,22 +82,31 @@ showProgressAllDone rc = do
      ("All urls downloaded. " % int % " files, " % int % " blocks.")
      totalfilec totalblockc

-- | show progress if at least one new block is fetched since last time. Otherwise, give a hint there may be a DL hang.
-- | show progress if at least one new block is fetched since last
-- time. Otherwise, give a hint there may be a DL hang. when all blocks are
-- fetched, return -1
showProgressMaybe :: RDClientRuntimeConfig -> Int -> IO Int
showProgressMaybe rc lastDownloadedBlockCount = do
  p <- readMVar (rdProgress rc)
  let newDLBC = piDownloadedBlockCount p
  if newDLBC > lastDownloadedBlockCount then do
  if newDLBC > lastDownloadedBlockCount
    then do
      showProgress1 rc p
      return newDLBC
  else do
    else
      if piDownloadedBlockCount p < piTotalBlockCount p
        then do
          warnl rc $ sformat ("No block fetched in last " % int % " seconds")
                (progressInterval (rdOptions rc))
          return lastDownloadedBlockCount
        else
          return (-1)

-- | show download progress in console. designed to run in a thread.
showProgressLoop :: RDClientRuntimeConfig -> Int -> IO ()
showProgressLoop rc lastDownloadedBlockCount = do
  threadDelay (progressInterval (rdOptions rc) * 1000000)
  newCount <- showProgressMaybe rc lastDownloadedBlockCount
  showProgressLoop rc newCount
  case newCount of
    -1 -> return ()
    _ -> showProgressLoop rc newCount