mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 00:52:04 +00:00
fixes an issue that devmgr ping cloud server every second
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -913,12 +913,13 @@ namespace Slic3r
|
|||||||
}
|
}
|
||||||
|
|
||||||
// do some refresh
|
// do some refresh
|
||||||
if (Slic3r::GUI::wxGetApp().is_user_login(Slic3r::GUI::wxGetApp().get_printer_cloud_provider()))
|
const auto cloud_provider = Slic3r::GUI::wxGetApp().get_printer_cloud_provider();
|
||||||
|
if (Slic3r::GUI::wxGetApp().is_user_login(cloud_provider))
|
||||||
{
|
{
|
||||||
m_manager->check_pushing();
|
m_manager->check_pushing();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
agent->refresh_connection();
|
agent->refresh_connection(cloud_provider);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public:
|
|||||||
class DeviceManagerRefresher : public wxObject
|
class DeviceManagerRefresher : public wxObject
|
||||||
{
|
{
|
||||||
wxTimer* m_timer{ nullptr };
|
wxTimer* m_timer{ nullptr };
|
||||||
int m_timer_interval_msec = 1000;
|
int m_timer_interval_msec = 5000;
|
||||||
|
|
||||||
DeviceManager* m_manager{ nullptr };
|
DeviceManager* m_manager{ nullptr };
|
||||||
|
|
||||||
|
|||||||
@@ -340,9 +340,17 @@ bool NetworkAgent::is_server_connected(const std::string& provider)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int NetworkAgent::refresh_connection()
|
int NetworkAgent::refresh_connection(const std::string& provider)
|
||||||
{
|
{
|
||||||
|
if(provider.empty())
|
||||||
return invoke_on_all_cloud_agents(m_cloud_agents, [](ICloudServiceAgent& cloud_agent) { return cloud_agent.refresh_connection(); });
|
return invoke_on_all_cloud_agents(m_cloud_agents, [](ICloudServiceAgent& cloud_agent) { return cloud_agent.refresh_connection(); });
|
||||||
|
else {
|
||||||
|
const auto cloud_agent = get_cloud_agent(provider);
|
||||||
|
if (cloud_agent)
|
||||||
|
return cloud_agent->refresh_connection();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NetworkAgent::enable_multi_machine(bool enable, const std::string& provider)
|
void NetworkAgent::enable_multi_machine(bool enable, const std::string& provider)
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
int set_on_http_error_fn(AppOnHttpErrorFn fn);
|
int set_on_http_error_fn(AppOnHttpErrorFn fn);
|
||||||
int set_get_country_code_fn(GetCountryCodeFn fn);
|
int set_get_country_code_fn(GetCountryCodeFn fn);
|
||||||
int connect_server();
|
int connect_server();
|
||||||
int refresh_connection();
|
int refresh_connection(const std::string& provider = "");
|
||||||
|
|
||||||
int change_user(std::string user_info, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
int change_user(std::string user_info, const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||||
bool is_user_login(const std::string& provider = ORCA_CLOUD_PROVIDER);
|
bool is_user_login(const std::string& provider = ORCA_CLOUD_PROVIDER);
|
||||||
|
|||||||
Reference in New Issue
Block a user