mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
chore: remove upload boost
Increasing chunks size, `kMaxUploadPerSession`, etc. don't change the speed, only if slows down. Maybe changing `kAcceptAsFastIfTotalAtLeast` could give a boost. Didn't check. In some circumstances, speed could be worse than on the AyuGram `v4.16` with boost, but it's rare. But the upload speed is good, so upload boost removed.
This commit is contained in:
parent
c55cab3b1a
commit
7cc14bda52
9 changed files with 8 additions and 56 deletions
|
@ -202,8 +202,6 @@ AyuGramSettings::AyuGramSettings() {
|
|||
collapseSimilarChannels = true;
|
||||
hideSimilarChannels = false;
|
||||
|
||||
uploadSpeedBoost = false;
|
||||
|
||||
disableNotificationsDelay = false;
|
||||
localPremium = false;
|
||||
copyUsernameAsLink = true;
|
||||
|
@ -329,10 +327,6 @@ void AyuGramSettings::set_hideSimilarChannels(bool val) {
|
|||
hideSimilarChannels = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_uploadSpeedBoost(bool val) {
|
||||
uploadSpeedBoost = val;
|
||||
}
|
||||
|
||||
void AyuGramSettings::set_disableNotificationsDelay(bool val) {
|
||||
disableNotificationsDelay = val;
|
||||
}
|
||||
|
|
|
@ -35,8 +35,6 @@ public:
|
|||
bool collapseSimilarChannels;
|
||||
bool hideSimilarChannels;
|
||||
|
||||
bool uploadSpeedBoost;
|
||||
|
||||
bool disableNotificationsDelay;
|
||||
bool localPremium;
|
||||
bool copyUsernameAsLink;
|
||||
|
@ -95,8 +93,6 @@ public:
|
|||
void set_collapseSimilarChannels(bool val);
|
||||
void set_hideSimilarChannels(bool val);
|
||||
|
||||
void set_uploadSpeedBoost(bool val);
|
||||
|
||||
void set_disableNotificationsDelay(bool val);
|
||||
void set_localPremium(bool val);
|
||||
void set_copyUsernameAsLink(bool val);
|
||||
|
@ -152,7 +148,6 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
|
|||
disableCustomBackgrounds,
|
||||
collapseSimilarChannels,
|
||||
hideSimilarChannels,
|
||||
uploadSpeedBoost,
|
||||
disableNotificationsDelay,
|
||||
localPremium,
|
||||
copyUsernameAsLink,
|
||||
|
|
|
@ -667,29 +667,6 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container) {
|
|||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::ayu_UploadSpeedBoostPC(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(settings->uploadSpeedBoost)
|
||||
)->toggledValue(
|
||||
) | rpl::filter(
|
||||
[=](bool enabled)
|
||||
{
|
||||
return (enabled != settings->uploadSpeedBoost);
|
||||
}) | start_with_next(
|
||||
[=](bool enabled)
|
||||
{
|
||||
settings->set_uploadSpeedBoost(enabled);
|
||||
AyuSettings::save();
|
||||
},
|
||||
container->lifetime());
|
||||
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::ayu_DisableNotificationsDelay(),
|
||||
|
|
|
@ -492,11 +492,7 @@ QString getMediaDC(not_null<HistoryItem*> message) {
|
|||
|
||||
int getScheduleTime(int64 sumSize) {
|
||||
auto time = 12;
|
||||
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
const auto multiplier = settings->uploadSpeedBoost ? 0.7 : 4.5;
|
||||
time += (int) std::ceil(std::max(6.0, std::ceil(sumSize / 1024.0 / 1024.0 * multiplier))) + 1;
|
||||
|
||||
time += (int) std::ceil(std::max(6.0, std::ceil(sumSize / 1024.0 / 1024.0 * 0.7))) + 1;
|
||||
return time;
|
||||
}
|
||||
|
||||
|
|
|
@ -443,7 +443,7 @@ LastCrashedWindow::LastCrashedWindow(
|
|||
});
|
||||
_saveReport.setText(u"SAVE TO FILE"_q);
|
||||
connect(&_saveReport, &QPushButton::clicked, [=] { saveReport(); });
|
||||
_getApp.setText(u"GET THE LATEST OFFICIAL VERSION OF AYUGRAM DESKTOP"_q);
|
||||
_getApp.setText(u"GET THE LATEST VERSION OF AYUGRAM DESKTOP"_q);
|
||||
connect(&_getApp, &QPushButton::clicked, [=] {
|
||||
QDesktopServices::openUrl(u"https://github.com/AyuGram/AyuGramDesktop"_q);
|
||||
});
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace Data {
|
|||
namespace {
|
||||
|
||||
constexpr auto kRefreshFullListEach = 60 * 60 * crl::time(1000);
|
||||
constexpr auto kPollEach = 10 * crl::time(1000);
|
||||
constexpr auto kPollEach = 15 * crl::time(1000);
|
||||
constexpr auto kSizeForDownscale = 64;
|
||||
constexpr auto kRecentRequestTimeout = 10 * crl::time(1000);
|
||||
constexpr auto kRecentReactionsLimit = 40;
|
||||
|
|
|
@ -13,10 +13,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "core/application.h"
|
||||
#include "base/call_delayed.h"
|
||||
|
||||
// AyuGram includes
|
||||
#include "ayu/ayu_settings.h"
|
||||
|
||||
|
||||
namespace MTP {
|
||||
namespace {
|
||||
|
||||
|
@ -84,12 +80,6 @@ std::optional<DedicatedLoader::File> ParseFile(
|
|||
return DedicatedLoader::File{ name, size, fields.vdc_id().v, location };
|
||||
}
|
||||
|
||||
int RequestCount() {
|
||||
const auto settings = &AyuSettings::getInstance();
|
||||
static const auto count = settings->uploadSpeedBoost ? 8 : 2;
|
||||
return count;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
WeakInstance::WeakInstance(base::weak_ptr<Main::Session> session)
|
||||
|
@ -320,7 +310,7 @@ void DedicatedLoader::startLoading() {
|
|||
}
|
||||
|
||||
void DedicatedLoader::sendRequest() {
|
||||
if (_requests.size() >= RequestCount() || _offset >= _size) {
|
||||
if (_requests.size() >= kRequestsCount || _offset >= _size) {
|
||||
return;
|
||||
}
|
||||
const auto offset = _offset;
|
||||
|
@ -336,7 +326,7 @@ void DedicatedLoader::sendRequest() {
|
|||
MTP::updaterDcId(_dcId));
|
||||
_offset += kChunkSize;
|
||||
|
||||
if (_requests.size() < RequestCount()) {
|
||||
if (_requests.size() < kRequestsCount) {
|
||||
base::call_delayed(kNextRequestDelay, this, [=] { sendRequest(); });
|
||||
}
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ private:
|
|||
void gotPart(int offset, const MTPupload_File &result);
|
||||
Fn<void(const Error &)> failHandler();
|
||||
|
||||
static constexpr auto kRequestsCount = 2;
|
||||
static constexpr auto kRequestsCount = 6;
|
||||
static constexpr auto kNextRequestDelay = crl::time(20);
|
||||
|
||||
std::deque<Request> _requests;
|
||||
|
|
|
@ -46,8 +46,8 @@ constexpr auto kDocumentUploadPartSize3 = 256 * 1024;
|
|||
// 512kb for large document ( <= 1500mb )
|
||||
constexpr auto kDocumentUploadPartSize4 = 512 * 1024;
|
||||
|
||||
// One part each half second, if not uploaded faster.
|
||||
constexpr auto kUploadRequestInterval = crl::time(250);
|
||||
// One part each 200ms, if not uploaded faster.
|
||||
constexpr auto kUploadRequestInterval = crl::time(200);
|
||||
|
||||
// How much time without upload causes additional session kill.
|
||||
constexpr auto kKillSessionTimeout = 15 * crl::time(1000);
|
||||
|
|
Loading…
Add table
Reference in a new issue