Fix request version error
This commit is contained in:
parent
0a210321ea
commit
4502709205
|
@ -15,6 +15,7 @@ export async function listIndexInstancesHost (): Promise<string[]> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getMajorInstanceVersion (host: string): Promise<number> {
|
export async function getMajorInstanceVersion (host: string): Promise<number> {
|
||||||
|
try {
|
||||||
const { body } = await doRequest<any>({ uri: `https://${host}/api/v1/config`, json: true })
|
const { body } = await doRequest<any>({ uri: `https://${host}/api/v1/config`, json: true })
|
||||||
|
|
||||||
const version = body.serverVersion
|
const version = body.serverVersion
|
||||||
|
@ -24,4 +25,7 @@ export async function getMajorInstanceVersion (host: string): Promise<number> {
|
||||||
return isNaN(majorVersion)
|
return isNaN(majorVersion)
|
||||||
? 0
|
? 0
|
||||||
: majorVersion
|
: majorVersion
|
||||||
|
} catch {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@ import { PlaylistIndexer } from '../indexers/playlist-indexer'
|
||||||
import { VideoIndexer } from '../indexers/video-indexer'
|
import { VideoIndexer } from '../indexers/video-indexer'
|
||||||
import { getPlaylistsOf, getVideos } from '../requests/peertube-instance'
|
import { getPlaylistsOf, getVideos } from '../requests/peertube-instance'
|
||||||
import { AbstractScheduler } from './abstract-scheduler'
|
import { AbstractScheduler } from './abstract-scheduler'
|
||||||
import { getMajorInstanceVersion } from '../requests/instances-index'
|
|
||||||
|
|
||||||
export class IndexationScheduler extends AbstractScheduler {
|
export class IndexationScheduler extends AbstractScheduler {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue