FIX: Fixup possible data lost in user presets

Change-Id: I345f770a14d674dd5e48c94505470ead3487b745
Jira: none
(cherry picked from commit c1e9cf4e233bfc1132a9ffc16d8e875f142be4f6)
This commit is contained in:
chunmao.guo
2023-10-26 20:15:36 +08:00
committed by Lane.Wei
parent dd666a6313
commit b9898d1cf5
2 changed files with 24 additions and 15 deletions

View File

@@ -4544,6 +4544,7 @@ void GUI_App::sync_preset(Preset* preset)
result = 0;
updated_info = "hold";
BOOST_LOG_TRIVIAL(error) << "[sync_preset] put setting_id = " << setting_id << " failed, http_code = " << http_code;
} else {
auto update_time_str = values_map[BBL_JSON_KEY_UPDATE_TIME];
if (!update_time_str.empty())
update_time = std::atoll(update_time_str.c_str());
@@ -4638,7 +4639,7 @@ void GUI_App::start_sync_user_preset(bool with_progress_dlg)
update_time = std::atoll(update_time_str.c_str());
if (type == "filament") {
return preset_bundle->filaments.need_sync(name, setting_id, update_time);
} else if (type == "machine") {
} else if (type == "print") {
return preset_bundle->prints.need_sync(name, setting_id, update_time);
} else if (type == "printer") {
return preset_bundle->printers.need_sync(name, setting_id, update_time);
@@ -4664,6 +4665,7 @@ void GUI_App::start_sync_user_preset(bool with_progress_dlg)
if (sync_count > 0) {
for (Preset& preset : presets_to_sync) {
sync_preset(&preset);
boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
}
}
@@ -4671,6 +4673,7 @@ void GUI_App::start_sync_user_preset(bool with_progress_dlg)
if (sync_count > 0) {
for (Preset& preset : presets_to_sync) {
sync_preset(&preset);
boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
}
}
@@ -4678,6 +4681,7 @@ void GUI_App::start_sync_user_preset(bool with_progress_dlg)
if (sync_count > 0) {
for (Preset& preset : presets_to_sync) {
sync_preset(&preset);
boost::this_thread::sleep_for(boost::chrono::milliseconds(100));
}
}