mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-15 16:20:03 +00:00
Improve log streaming performance by using Coroutines instead of platform threads
Refactor log streaming to use a replay which eliminates the need to read the log file each time for a new subscriber and instead caches the elements directly in the sink Fix bug in log tailing (was running with two threads instead of one)
This commit is contained in:
@@ -8,19 +8,17 @@ import {Button, Code, Divider, Tooltip} from "@nextui-org/react";
|
||||
import {ArrowUDownLeft, SortAscending} from "@phosphor-icons/react";
|
||||
|
||||
function LogManagementLayout({getConfig, formik}: any) {
|
||||
|
||||
const [logEntries, setLogEntries] = useState<string[]>([]);
|
||||
const [autoScroll, setAutoScroll] = useState(true);
|
||||
const [softWrap, setSoftWrap] = useState(false);
|
||||
const subscribed = useRef(false);
|
||||
const logEndRef = useRef<null | HTMLDivElement>(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (subscribed.current) return;
|
||||
LogEndpoint.getApplicationLogs().onNext((newEntry: string | undefined) =>
|
||||
const sub = LogEndpoint.getApplicationLogs().onNext((newEntry: string | undefined) =>
|
||||
setLogEntries((currentEntries) => [...currentEntries, newEntry as string])
|
||||
);
|
||||
subscribed.current = true;
|
||||
|
||||
return () => sub.cancel();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -29,4 +29,5 @@ const menuItems: MenuItem[] = [
|
||||
}
|
||||
]
|
||||
|
||||
export const AdministrationView = withSideMenu(menuItems);
|
||||
export const AdministrationView = withSideMenu(menuItems);
|
||||
export default AdministrationView;
|
||||
@@ -19,4 +19,5 @@ const menuItems = [
|
||||
}
|
||||
]
|
||||
|
||||
export const ProfileView = withSideMenu(menuItems);
|
||||
export const ProfileView = withSideMenu(menuItems);
|
||||
export default ProfileView;
|
||||
Reference in New Issue
Block a user