Remove automatic manga update (#583)
Since the server now has an automatic global update functionality, this is not needed anymore
This commit is contained in:
@@ -21,8 +21,6 @@ import { MangaToolbarMenu } from '@/components/manga/MangaToolbarMenu';
|
|||||||
import { EmptyView } from '@/components/util/EmptyView';
|
import { EmptyView } from '@/components/util/EmptyView';
|
||||||
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder';
|
import { LoadingPlaceholder } from '@/components/util/LoadingPlaceholder';
|
||||||
|
|
||||||
const AUTOFETCH_AGE = 1000 * 60 * 60 * 24; // 24 hours
|
|
||||||
|
|
||||||
export const Manga: React.FC = () => {
|
export const Manga: React.FC = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
@@ -38,17 +36,9 @@ export const Manga: React.FC = () => {
|
|||||||
useSetDefaultBackTo('library');
|
useSetDefaultBackTo('library');
|
||||||
|
|
||||||
useEffect(() => {
|
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;
|
if (manga == null) return;
|
||||||
|
|
||||||
const isOutdated =
|
const doFetch = !autofetchedRef.current && !manga.initialized;
|
||||||
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);
|
|
||||||
if (doFetch) {
|
if (doFetch) {
|
||||||
autofetchedRef.current = true;
|
autofetchedRef.current = true;
|
||||||
refresh();
|
refresh();
|
||||||
|
|||||||
Reference in New Issue
Block a user