add skip if buffer still full
This commit is contained in:
parent
e51064771b
commit
009ee509d5
1 changed files with 3 additions and 0 deletions
|
|
@ -36,6 +36,7 @@
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include "actsim_agent.hpp"
|
||||||
#include "agent_artifact.hpp"
|
#include "agent_artifact.hpp"
|
||||||
#include "cluster/db_types.hpp"
|
#include "cluster/db_types.hpp"
|
||||||
#include "pqxx/prepared_statement.hxx"
|
#include "pqxx/prepared_statement.hxx"
|
||||||
|
|
@ -79,6 +80,8 @@ void Downloader::thread_run() {
|
||||||
// make sure we weren't woken up because the program closed
|
// make sure we weren't woken up because the program closed
|
||||||
if (!this->interface.running()) break;
|
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 the download buffer is not full, fetch some more tasks
|
||||||
if (!this->fetch_tasks(this->interface.get_buffer_space())) {
|
if (!this->fetch_tasks(this->interface.get_buffer_space())) {
|
||||||
// we can sleep for a certain amount of time, nothing to do
|
// we can sleep for a certain amount of time, nothing to do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue