Reduce requested downloader data in queries

This commit is contained in:
schroda
2024-07-06 15:28:27 +02:00
parent cb978d9a0e
commit df006bb348
7 changed files with 74 additions and 59 deletions

View File

@@ -185,28 +185,6 @@ export const FULL_EXTENSION_FIELDS = gql`
} }
`; `;
export const FULL_DOWNLOAD_STATUS = gql`
fragment FULL_DOWNLOAD_STATUS on DownloadStatus {
queue {
chapter {
id
name
sourceOrder
isDownloaded
manga {
id
title
downloadCount
}
}
progress
state
tries
}
state
}
`;
export const ABOUT_WEBUI = gql` export const ABOUT_WEBUI = gql`
fragment ABOUT_WEBUI on AboutWebUI { fragment ABOUT_WEBUI on AboutWebUI {
channel channel

View File

@@ -0,0 +1,34 @@
/*
* Copyright (C) Contributors to the Suwayomi project
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
import gql from 'graphql-tag';
export const DOWNLOAD_STATUS_FIELDS = gql`
fragment DOWNLOAD_STATUS_FIELDS on DownloadStatus {
state
queue {
chapter {
id
name
sourceOrder
isDownloaded
}
manga {
id
title
downloadCount
}
progress
state
tries
}
}
`;

File diff suppressed because one or more lines are too long

View File

@@ -7,15 +7,16 @@
*/ */
import gql from 'graphql-tag'; import gql from 'graphql-tag';
import { FULL_DOWNLOAD_STATUS } from '@/lib/graphql/Fragments'; import { DOWNLOAD_STATUS_FIELDS } from '@/lib/graphql/fragments/DownloadFragments.ts';
export const CLEAR_DOWNLOADER = gql` export const CLEAR_DOWNLOADER = gql`
${FULL_DOWNLOAD_STATUS} ${DOWNLOAD_STATUS_FIELDS}
mutation CLEAR_DOWNLOADER($input: ClearDownloaderInput = {}) { mutation CLEAR_DOWNLOADER($input: ClearDownloaderInput = {}) {
clearDownloader(input: $input) { clearDownloader(input: $input) {
clientMutationId clientMutationId
downloadStatus { downloadStatus {
...FULL_DOWNLOAD_STATUS ...DOWNLOAD_STATUS_FIELDS
} }
} }
} }
@@ -54,60 +55,65 @@ export const DELETE_DOWNLOADED_CHAPTERS = gql`
`; `;
export const DEQUEUE_CHAPTER_DOWNLOAD = gql` export const DEQUEUE_CHAPTER_DOWNLOAD = gql`
${FULL_DOWNLOAD_STATUS} ${DOWNLOAD_STATUS_FIELDS}
mutation DEQUEUE_CHAPTER_DOWNLOAD($input: DequeueChapterDownloadInput!) { mutation DEQUEUE_CHAPTER_DOWNLOAD($input: DequeueChapterDownloadInput!) {
dequeueChapterDownload(input: $input) { dequeueChapterDownload(input: $input) {
clientMutationId clientMutationId
downloadStatus { downloadStatus {
...FULL_DOWNLOAD_STATUS ...DOWNLOAD_STATUS_FIELDS
} }
} }
} }
`; `;
export const DEQUEUE_CHAPTER_DOWNLOADS = gql` export const DEQUEUE_CHAPTER_DOWNLOADS = gql`
${FULL_DOWNLOAD_STATUS} ${DOWNLOAD_STATUS_FIELDS}
mutation DEQUEUE_CHAPTER_DOWNLOADS($input: DequeueChapterDownloadsInput!) { mutation DEQUEUE_CHAPTER_DOWNLOADS($input: DequeueChapterDownloadsInput!) {
dequeueChapterDownloads(input: $input) { dequeueChapterDownloads(input: $input) {
clientMutationId clientMutationId
downloadStatus { downloadStatus {
...FULL_DOWNLOAD_STATUS ...DOWNLOAD_STATUS_FIELDS
} }
} }
} }
`; `;
export const ENQUEUE_CHAPTER_DOWNLOAD = gql` export const ENQUEUE_CHAPTER_DOWNLOAD = gql`
${FULL_DOWNLOAD_STATUS} ${DOWNLOAD_STATUS_FIELDS}
mutation ENQUEUE_CHAPTER_DOWNLOAD($input: EnqueueChapterDownloadInput!) { mutation ENQUEUE_CHAPTER_DOWNLOAD($input: EnqueueChapterDownloadInput!) {
enqueueChapterDownload(input: $input) { enqueueChapterDownload(input: $input) {
clientMutationId clientMutationId
downloadStatus { downloadStatus {
...FULL_DOWNLOAD_STATUS ...DOWNLOAD_STATUS_FIELDS
} }
} }
} }
`; `;
export const ENQUEUE_CHAPTER_DOWNLOADS = gql` export const ENQUEUE_CHAPTER_DOWNLOADS = gql`
${FULL_DOWNLOAD_STATUS} ${DOWNLOAD_STATUS_FIELDS}
mutation ENQUEUE_CHAPTER_DOWNLOADS($input: EnqueueChapterDownloadsInput!) { mutation ENQUEUE_CHAPTER_DOWNLOADS($input: EnqueueChapterDownloadsInput!) {
enqueueChapterDownloads(input: $input) { enqueueChapterDownloads(input: $input) {
clientMutationId clientMutationId
downloadStatus { downloadStatus {
...FULL_DOWNLOAD_STATUS ...DOWNLOAD_STATUS_FIELDS
} }
} }
} }
`; `;
export const REORDER_CHAPTER_DOWNLOAD = gql` export const REORDER_CHAPTER_DOWNLOAD = gql`
${FULL_DOWNLOAD_STATUS} ${DOWNLOAD_STATUS_FIELDS}
mutation REORDER_CHAPTER_DOWNLOAD($input: ReorderChapterDownloadInput!) { mutation REORDER_CHAPTER_DOWNLOAD($input: ReorderChapterDownloadInput!) {
reorderChapterDownload(input: $input) { reorderChapterDownload(input: $input) {
clientMutationId clientMutationId
downloadStatus { downloadStatus {
...FULL_DOWNLOAD_STATUS ...DOWNLOAD_STATUS_FIELDS
} }
} }
} }

View File

@@ -7,13 +7,14 @@
*/ */
import gql from 'graphql-tag'; import gql from 'graphql-tag';
import { FULL_DOWNLOAD_STATUS } from '@/lib/graphql/Fragments'; import { DOWNLOAD_STATUS_FIELDS } from '@/lib/graphql/fragments/DownloadFragments.ts';
export const GET_DOWNLOAD_STATUS = gql` export const GET_DOWNLOAD_STATUS = gql`
${FULL_DOWNLOAD_STATUS} ${DOWNLOAD_STATUS_FIELDS}
query GET_DOWNLOAD_STATUS { query GET_DOWNLOAD_STATUS {
downloadStatus { downloadStatus {
...FULL_DOWNLOAD_STATUS ...DOWNLOAD_STATUS_FIELDS
} }
} }
`; `;

View File

@@ -7,13 +7,14 @@
*/ */
import gql from 'graphql-tag'; import gql from 'graphql-tag';
import { FULL_DOWNLOAD_STATUS } from '@/lib/graphql/Fragments'; import { DOWNLOAD_STATUS_FIELDS } from '@/lib/graphql/fragments/DownloadFragments.ts';
export const DOWNLOAD_STATUS_SUBSCRIPTION = gql` export const DOWNLOAD_STATUS_SUBSCRIPTION = gql`
${FULL_DOWNLOAD_STATUS} ${DOWNLOAD_STATUS_FIELDS}
subscription DOWNLOAD_STATUS_SUBSCRIPTION { subscription DOWNLOAD_STATUS_SUBSCRIPTION {
downloadChanged { downloadChanged {
...FULL_DOWNLOAD_STATUS ...DOWNLOAD_STATUS_FIELDS
} }
} }
`; `;

View File

@@ -283,12 +283,7 @@ import { DOWNLOAD_STATUS_SUBSCRIPTION } from '@/lib/graphql/subscriptions/Downlo
import { UPDATER_SUBSCRIPTION } from '@/lib/graphql/subscriptions/UpdaterSubscription.ts'; import { UPDATER_SUBSCRIPTION } from '@/lib/graphql/subscriptions/UpdaterSubscription.ts';
import { GET_SERVER_SETTINGS } from '@/lib/graphql/queries/SettingsQuery.ts'; import { GET_SERVER_SETTINGS } from '@/lib/graphql/queries/SettingsQuery.ts';
import { UPDATE_SERVER_SETTINGS } from '@/lib/graphql/mutations/SettingsMutation.ts'; import { UPDATE_SERVER_SETTINGS } from '@/lib/graphql/mutations/SettingsMutation.ts';
import { import { BASE_MANGA_FIELDS, FULL_EXTENSION_FIELDS, GLOBAL_METADATA } from '@/lib/graphql/Fragments.ts';
BASE_MANGA_FIELDS,
FULL_DOWNLOAD_STATUS,
FULL_EXTENSION_FIELDS,
GLOBAL_METADATA,
} from '@/lib/graphql/Fragments.ts';
import { CLEAR_SERVER_CACHE } from '@/lib/graphql/mutations/ImageMutation.ts'; import { CLEAR_SERVER_CACHE } from '@/lib/graphql/mutations/ImageMutation.ts';
import { RESET_WEBUI_UPDATE_STATUS, UPDATE_WEBUI } from '@/lib/graphql/mutations/ServerInfoMutation.ts'; import { RESET_WEBUI_UPDATE_STATUS, UPDATE_WEBUI } from '@/lib/graphql/mutations/ServerInfoMutation.ts';
import { WEBUI_UPDATE_SUBSCRIPTION } from '@/lib/graphql/subscriptions/ServerInfoSubscription.ts'; import { WEBUI_UPDATE_SUBSCRIPTION } from '@/lib/graphql/subscriptions/ServerInfoSubscription.ts';
@@ -307,6 +302,7 @@ import {
} from '@/lib/graphql/mutations/TrackerMutation.ts'; } from '@/lib/graphql/mutations/TrackerMutation.ts';
import { ControlledPromise } from '@/lib/ControlledPromise.ts'; import { ControlledPromise } from '@/lib/ControlledPromise.ts';
import { MetadataMigrationSettings, TManga } from '@/typings.ts'; import { MetadataMigrationSettings, TManga } from '@/typings.ts';
import { DOWNLOAD_STATUS_FIELDS } from '@/lib/graphql/fragments/DownloadFragments.ts';
enum GQLMethod { enum GQLMethod {
QUERY = 'QUERY', QUERY = 'QUERY',
@@ -2334,7 +2330,7 @@ export class RequestManager {
DownloadStatusSubscription['downloadChanged'] DownloadStatusSubscription['downloadChanged']
>({ >({
id: 'DownloadStatus:{}', id: 'DownloadStatus:{}',
fragment: FULL_DOWNLOAD_STATUS, fragment: DOWNLOAD_STATUS_FIELDS,
}); });
if (!variables) { if (!variables) {