Skip to content
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
12 changes: 12 additions & 0 deletions rust/agama-lib/src/product/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use super::{ProductHTTPClient, ProductSettings};
use crate::base_http_client::BaseHTTPClient;
use crate::error::ServiceError;
use crate::manager::http_client::ManagerHTTPClient;
use std::{thread, time};

/// Loads and stores the product settings from/to the D-Bus service.
pub struct ProductStore {
Expand Down Expand Up @@ -76,6 +77,17 @@ impl ProductStore {
}
if let Some(reg_code) = &settings.registration_code {
let email = settings.registration_email.as_deref().unwrap_or("");

if probe {
// give the UI a short time for processing the events related to changing the
// product before starting registration because it triggers another pile of events
// in the Web UI as well (workaround for gh#agama-project#2274)
// even 1 second should be enough, but rather be safe and use 5s for slow networks,
// in autoinstallation it does not hurt
let delay = time::Duration::from_secs(5);
thread::sleep(delay);
}

self.product_client.register(reg_code, email).await?;
// TODO: avoid reprobing if the system has been already registered with the same code?
probe = true;
Expand Down
7 changes: 7 additions & 0 deletions rust/package/agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Apr 22 11:16:29 UTC 2025 - Ladislav Slezák <lslezak@suse.com>

- CLI: wait a bit between selecting the product to install and
registering it so the Web UI has enough time to process all
events (gh#agama-project/agama#2274)

-------------------------------------------------------------------
Mon Apr 21 13:42:13 UTC 2025 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

Expand Down
7 changes: 7 additions & 0 deletions web/package/agama-web-ui.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Apr 22 11:18:03 UTC 2025 - Ladislav Slezák <lslezak@suse.com>

- Process the product changed event so the UI can better react on
registering the product shortly after that
(gh#agama-project/agama#2274)

-------------------------------------------------------------------
Mon Apr 21 12:37:20 UTC 2025 - Imobach Gonzalez Sosa <igonzalezsosa@suse.com>

Expand Down
5 changes: 5 additions & 0 deletions web/src/queries/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { fetchInstallerStatus } from "~/api/status";
import { useInstallerClient } from "~/context/installer";
import { InstallerStatus } from "~/types/status";
import { QueryHookOptions } from "~/types/queries";
import { selectedProductQuery } from "./software";

const MANAGER_SERVICE = "org.opensuse.Agama.Manager1";

Expand Down Expand Up @@ -81,6 +82,10 @@ const useInstallerStatusChanges = () => {
if (type === "IssuesChanged") {
queryClient.invalidateQueries({ queryKey: ["status"] });
}

if (event.type === "ProductChanged") {
queryClient.invalidateQueries({ queryKey: selectedProductQuery().queryKey });
}
});
});
};
Expand Down
Loading