Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/article read chunk size #52

Merged
merged 3 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions daemon/main/Options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ static const char* OPTION_CERTSTORE = "CertStore";
static const char* OPTION_CERTCHECK = "CertCheck";
static const char* OPTION_AUTHORIZEDIP = "AuthorizedIP";
static const char* OPTION_ARTICLETIMEOUT = "ArticleTimeout";
static const char* OPTION_ARTICLEREADCHUNKSIZE = "ArticleReadChunkSize";
static const char* OPTION_URLTIMEOUT = "UrlTimeout";
static const char* OPTION_REMOTETIMEOUT = "RemoteTimeout";
static const char* OPTION_FLUSHQUEUE = "FlushQueue";
Expand Down Expand Up @@ -447,6 +448,7 @@ void Options::InitDefaults()
SetOption(OPTION_CERTCHECK, "no");
SetOption(OPTION_AUTHORIZEDIP, "");
SetOption(OPTION_ARTICLETIMEOUT, "60");
SetOption(OPTION_ARTICLEREADCHUNKSIZE, "4");
SetOption(OPTION_URLTIMEOUT, "60");
SetOption(OPTION_REMOTETIMEOUT, "90");
SetOption(OPTION_FLUSHQUEUE, "yes");
Expand Down Expand Up @@ -694,6 +696,7 @@ void Options::InitOptions()

m_downloadRate = ParseIntValue(OPTION_DOWNLOADRATE, 10) * 1024;
m_articleTimeout = ParseIntValue(OPTION_ARTICLETIMEOUT, 10);
m_articleReadChunkSize = ParseIntValue(OPTION_ARTICLEREADCHUNKSIZE, 10) * 1024;
m_urlTimeout = ParseIntValue(OPTION_URLTIMEOUT, 10);
m_remoteTimeout = ParseIntValue(OPTION_REMOTETIMEOUT, 10);
m_articleRetries = ParseIntValue(OPTION_ARTICLERETRIES, 10);
Expand Down
2 changes: 2 additions & 0 deletions daemon/main/Options.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ class Options
EMessageTarget GetDebugTarget() const { return m_debugTarget; }
EMessageTarget GetDetailTarget() const { return m_detailTarget; }
int GetArticleTimeout() { return m_articleTimeout; }
int GetArticleReadChunkSize() { return m_articleReadChunkSize; }
int GetUrlTimeout() { return m_urlTimeout; }
int GetRemoteTimeout() { return m_remoteTimeout; }
bool GetRawArticle() { return m_rawArticle; };
Expand Down Expand Up @@ -345,6 +346,7 @@ class Options
bool m_rawArticle = false;
bool m_nzbLog = false;
int m_articleTimeout = 0;
int m_articleReadChunkSize = 4;
int m_urlTimeout = 0;
int m_remoteTimeout = 0;
bool m_appendCategoryDir = false;
Expand Down
2 changes: 1 addition & 1 deletion daemon/nntp/ArticleDownloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ ArticleDownloader::EStatus ArticleDownloader::Download()
m_decoder.SetRawMode(g_Options->GetRawArticle());

status = adRunning;
CharBuffer lineBuf(1024*4);
CharBuffer lineBuf(g_Options->GetArticleReadChunkSize());

while (!IsStopped() && !m_decoder.GetEof())
{
Expand Down
3 changes: 3 additions & 0 deletions nzbget.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1004,6 +1004,9 @@ ArticleInterval=10
# Connection timeout for article downloading (seconds).
ArticleTimeout=60

# Chunk size when reading data from the news server (kilobytes).
ArticleReadChunkSize=4

# Number of download attempts for URL fetching (0-99).
#
# If fetching of nzb-file via URL or fetching of RSS feed fails another
Expand Down