add skip if buffer still full

This commit is contained in:
Fabian Posch 2025-01-31 01:08:38 +01:00
parent e51064771b
commit 009ee509d5

View file

@ -36,6 +36,7 @@
#include <functional>
#include <unordered_set>
#include <vector>
#include "actsim_agent.hpp"
#include "agent_artifact.hpp"
#include "cluster/db_types.hpp"
#include "pqxx/prepared_statement.hxx"
@ -79,6 +80,8 @@ void Downloader::thread_run() {
// make sure we weren't woken up because the program closed
if (!this->interface.running()) break;
if (this->interface.get_buffer_space() < DOWNLOAD_BUFFER * 0.8) continue;
// if the download buffer is not full, fetch some more tasks
if (!this->fetch_tasks(this->interface.get_buffer_space())) {
// we can sleep for a certain amount of time, nothing to do