limit how often progress bar can update

This commit is contained in:
ouwou
2022-07-25 01:10:31 -04:00
parent 8396d07d9e
commit 3610a2508b
2 changed files with 5 additions and 0 deletions

View File

@@ -476,7 +476,10 @@ void DiscordClient::SendChatMessageAttachments(const ChatSubmitParams &params, c
obj.MessageReference.emplace().MessageID = params.InReplyToID;
auto req = m_http.CreateRequest(http::REQUEST_POST, "/channels/" + std::to_string(params.ChannelID) + "/messages");
m_progress_cb_timer.start();
req.set_progress_callback([this, nonce](curl_off_t ultotal, curl_off_t ulnow) {
if (m_progress_cb_timer.elapsed() < 0.0417) return; // try to prevent it from blocking ui
m_progress_cb_timer.start();
m_generic_mutex.lock();
m_generic_queue.push([this, nonce, ultotal, ulnow] {
m_signal_message_progress.emit(

View File

@@ -345,6 +345,8 @@ private:
Glib::Dispatcher m_generic_dispatch;
std::queue<std::function<void()>> m_generic_queue;
Glib::Timer m_progress_cb_timer;
std::set<Snowflake> m_channels_pinned_requested;
std::set<Snowflake> m_channels_lazy_loaded;