diff --git a/Cargo.lock b/Cargo.lock index 630a728b90..cafc64e246 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4464,7 +4464,7 @@ checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f" [[package]] name = "ryot" -version = "2.18.4" +version = "2.18.5" dependencies = [ "anyhow", "apalis", diff --git a/apps/backend/Cargo.toml b/apps/backend/Cargo.toml index 608386dd21..2c6034e73b 100644 --- a/apps/backend/Cargo.toml +++ b/apps/backend/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ryot" -version = "2.18.4" +version = "2.18.5" edition = "2021" repository = "https://github.com/IgnisDa/ryot" license = "GPL-V3" diff --git a/apps/backend/src/config.rs b/apps/backend/src/config.rs index 9ad31e028b..e5328e7344 100644 --- a/apps/backend/src/config.rs +++ b/apps/backend/src/config.rs @@ -418,6 +418,11 @@ pub struct ServerConfig { pub insecure_cookie: bool, /// This will set SameSite=None on the auth cookies. pub samesite_none: bool, + /// The number of seconds after which a new application job is checked for. + /// Reducing this number will increase memory consumption but make certain + /// actions (eg: items automatically being added to "In Progress") faster. + #[setting(default = 5)] + pub application_job_check_seconds: u64, /// The hours in which a media can be marked as seen again for a user. This /// is used so that the same media can not be used marked as started when /// it has been already marked as seen in the last `n` hours. diff --git a/apps/backend/src/main.rs b/apps/backend/src/main.rs index bb44a3e401..9b0b3c616a 100644 --- a/apps/backend/src/main.rs +++ b/apps/backend/src/main.rs @@ -93,6 +93,7 @@ async fn main() -> Result<()> { let user_cleanup_every = config.scheduler.user_cleanup_every; let pull_every = config.integration.pull_every; let max_file_size = config.server.max_file_size; + let new_background_job_check_seconds = config.server.application_job_check_seconds; fs::write( &config.server.config_dump_path, serde_json::to_string_pretty(&config)?, @@ -288,7 +289,9 @@ async fn main() -> Result<()> { .layer(ApalisExtension(importer_service_1.clone())) .layer(ApalisExtension(media_service_4.clone())) .layer(ApalisExtension(exercise_service_1.clone())) - .with_storage(perform_application_job_storage.clone()) + .with_storage_config(perform_application_job_storage.clone(), |cfg| { + cfg.fetch_interval(Duration::from_secs(new_background_job_check_seconds)) + }) .build_fn(perform_application_job) }) .run() diff --git a/apps/frontend/src/pages/index.tsx b/apps/frontend/src/pages/index.tsx index 06c2746b78..0e4c95bed9 100644 --- a/apps/frontend/src/pages/index.tsx +++ b/apps/frontend/src/pages/index.tsx @@ -65,7 +65,7 @@ today.setHours(0, 0, 0, 0); const UpComingMedia = ({ um }: { um: CalendarEventPartFragment }) => { const diff = DateTime.fromISO(um.date).diff(DateTime.fromJSDate(today)); const numDaysLeft = parseInt(diff.as("days").toFixed(0)); - console.log(diff.as("days").toFixed(0)); + return ( { const ActualDisplayStat = (props: { icon: JSX.Element; lot: string; - data: { type: "duration" | "number"; label: string; value: number }[]; + data: { + type: "duration" | "number"; + label: string; + value: number; + hideIfZero?: true; + }[]; color?: string; }) => { const theme = useMantineTheme(); @@ -110,25 +115,27 @@ const ActualDisplayStat = (props: { rootColor={props.color ?? colors[11]} /> - {props.data.map((d, idx) => ( - - - {d.type === "duration" - ? humanizer.humanize(d.value * 1000 * 60, { - round: true, - largest: 3, - }) - : humanFormat(d.value)} - - - {d.label === "Runtime" ? "" : d.label} - - - ))} + {props.data.map((d, idx) => + d.type === "number" && d.value === 0 && d.hideIfZero ? undefined : ( + + + {d.type === "duration" + ? humanizer.humanize(d.value * 1000 * 60, { + round: true, + largest: 3, + }) + : humanFormat(d.value)} + + + {d.label === "Runtime" ? "" : d.label} + + + ), + )} ); @@ -437,6 +444,7 @@ const Page: NextPageWithLayout = () => { label: "Reviews", value: latestUserSummary.data.media.reviewsPosted, type: "number", + hideIfZero: true, }, { label: "People", @@ -461,6 +469,7 @@ const Page: NextPageWithLayout = () => { label: "Workouts", value: latestUserSummary.data.fitness.workoutsRecorded, type: "number", + hideIfZero: true, }, ]} /> diff --git a/apps/frontend/src/pages/media/list.tsx b/apps/frontend/src/pages/media/list.tsx index 2e82df89f9..b577c7a48b 100644 --- a/apps/frontend/src/pages/media/list.tsx +++ b/apps/frontend/src/pages/media/list.tsx @@ -157,6 +157,7 @@ const Page: NextPageWithLayout = () => { return mediaList; }, enabled: lot !== undefined && activeTab === "mine", + retry: false, }); const collections = useQuery({ queryKey: ["collections"], @@ -205,6 +206,7 @@ const Page: NextPageWithLayout = () => { }, enabled: query !== "" && lot !== undefined && activeTab === "search", staleTime: Infinity, + retry: false, }); useEffect(() => { diff --git a/docs/includes/backend-config-schema.ts b/docs/includes/backend-config-schema.ts index a16dd14082..6609d45abd 100644 --- a/docs/includes/backend-config-schema.ts +++ b/docs/includes/backend-config-schema.ts @@ -190,6 +190,13 @@ export interface SchedulerConfig { } export interface ServerConfig { + /** + * The number of seconds after which a new application job is checked for. + * Reducing this number will increase memory consumption but make certain + * actions (eg: items automatically being added to "In Progress") faster. + * @default 5 + */ + application_job_check_seconds: number; /** The path where the config file will be written once the server boots up. */ config_dump_path: string; /** An array of URLs for CORS. */