Skip to content

Commit

Permalink
Remove automatic manga update (#583)
Browse files Browse the repository at this point in the history
Since the server now has an automatic global update functionality, this is not needed anymore
  • Loading branch information
schroda authored Jan 29, 2024
1 parent d6468bc commit c483e71
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions src/screens/Manga.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ import { MangaToolbarMenu } from '@/components/manga/MangaToolbarMenu';
import { EmptyView } from '@/components/util/EmptyView';
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder';

const AUTOFETCH_AGE = 1000 * 60 * 60 * 24; // 24 hours

export const Manga: React.FC = () => {
const { t } = useTranslation();

Expand All @@ -38,17 +36,9 @@ export const Manga: React.FC = () => {
useSetDefaultBackTo('library');

useEffect(() => {
// Automatically fetch manga from source if data is older then 24 hours OR manga is not initialized yet
// Automatic fetch is done only once, to prevent issues when server does
// not update age for some reason (ie. error on source side)
if (manga == null) return;

const isOutdated =
Date.now() - Number(manga.lastFetchedAt) * 1000 > AUTOFETCH_AGE ||
Date.now() - Number(manga.chaptersLastFetchedAt) * 1000 > AUTOFETCH_AGE;
const refetchBecauseOutdated = manga.inLibrary && isOutdated;

const doFetch = !autofetchedRef.current && (refetchBecauseOutdated || !manga.initialized);
const doFetch = !autofetchedRef.current && !manga.initialized;
if (doFetch) {
autofetchedRef.current = true;
refresh();
Expand Down

0 comments on commit c483e71

Please sign in to comment.