diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-08-14T18·14+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-08-16T18·56+0200 |
commit | c36467ad2e2e27d04e681144e0e10417c53c10c1 (patch) | |
tree | bd4da6a3778873c5dfb976260a87e9c0a558cff0 /src/libstore/download.cc | |
parent | b29b6feaba715432490e275a025b3361a021a99b (diff) |
Improve substitution progress indicator
E.g. $ nix build --store local?root=/tmp/nix nixpkgs.firefox-unwrapped [0/1 built, 1/97/98 fetched, 65.8/92.8 MiB DL, 203.2/309.2 MiB copied] downloading 'https://cache.nixos.org/nar/1czm9fk0svacy4h6a3fzkpafi4f7a9gml36kk8cq1igaghbspg3k.nar.xz'
Diffstat (limited to 'src/libstore/download.cc')
-rw-r--r-- | src/libstore/download.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libstore/download.cc b/src/libstore/download.cc index b731297a2086..9ac4a65d5706 100644 --- a/src/libstore/download.cc +++ b/src/libstore/download.cc @@ -83,12 +83,12 @@ struct CurlDownloader : public Downloader std::string encoding; DownloadItem(CurlDownloader & downloader, const DownloadRequest & request) - : downloader(downloader), request(request) + : downloader(downloader) + , request(request) + , act(actDownload, fmt("downloading '%s'", request.uri)) { if (!request.expectedETag.empty()) requestHeaders = curl_slist_append(requestHeaders, ("If-None-Match: " + request.expectedETag).c_str()); - - logger->event(evDownloadCreated, act, request.uri); } ~DownloadItem() @@ -105,7 +105,6 @@ struct CurlDownloader : public Downloader } catch (...) { ignoreException(); } - logger->event(evDownloadDestroyed, act); } template<class T> @@ -168,7 +167,7 @@ struct CurlDownloader : public Downloader int progressCallback(double dltotal, double dlnow) { - logger->event(evDownloadProgress, act, dltotal, dlnow); + act.progress(dlnow, dltotal); return _isInterrupted; } @@ -267,7 +266,7 @@ struct CurlDownloader : public Downloader try { result.data = decodeContent(encoding, ref<std::string>(result.data)); callSuccess(success, failure, const_cast<const DownloadResult &>(result)); - logger->event(evDownloadSucceeded, act, result.data->size()); + act.progress(result.data->size(), result.data->size()); } catch (...) { done = true; callFailure(failure, std::current_exception()); |