mirror of
https://github.com/apricote/Listory.git
synced 2026-01-13 21:21:02 +00:00
chore(lint): switch to eslint
This commit is contained in:
parent
f56548e432
commit
9b96d0fab4
29 changed files with 1609 additions and 113 deletions
|
|
@ -1,8 +1,4 @@
|
|||
import {
|
||||
Injectable,
|
||||
OnApplicationBootstrap,
|
||||
OnModuleInit,
|
||||
} from "@nestjs/common";
|
||||
import { Injectable, OnApplicationBootstrap } from "@nestjs/common";
|
||||
import { ConfigService } from "@nestjs/config";
|
||||
import { SchedulerRegistry } from "@nestjs/schedule";
|
||||
import { captureException } from "@sentry/node";
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { Module } from "@nestjs/common";
|
||||
import { ConfigModule } from "../config/config.module";
|
||||
import { SchedulerService } from "./scheduler.service";
|
||||
import { SpotifyModule } from "./spotify/spotify.module";
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ export class SpotifyApiService {
|
|||
|
||||
async getRecentlyPlayedTracks({
|
||||
accessToken,
|
||||
lastRefreshTime,
|
||||
}: SpotifyConnection): Promise<PlayHistoryObject[]> {
|
||||
const parameters: { limit: number; after?: number } = {
|
||||
limit: 50,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ export class SpotifyService {
|
|||
const users = await this.usersService.findAll();
|
||||
|
||||
for (const user of users) {
|
||||
// We want to run this sequentially to avoid rate limits
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await this.crawlListensForUser(user);
|
||||
}
|
||||
}
|
||||
|
|
@ -142,7 +144,7 @@ export class SpotifyService {
|
|||
spotifyID
|
||||
);
|
||||
} catch (err) {
|
||||
if (err.response && err.response.status === 401) {
|
||||
if (err.response && err.response.status === 401 && retryOnExpiredToken) {
|
||||
await this.refreshAppAccessToken();
|
||||
|
||||
return this.importTrack(spotifyID, false);
|
||||
|
|
@ -192,7 +194,7 @@ export class SpotifyService {
|
|||
spotifyID
|
||||
);
|
||||
} catch (err) {
|
||||
if (err.response && err.response.status === 401) {
|
||||
if (err.response && err.response.status === 401 && retryOnExpiredToken) {
|
||||
await this.refreshAppAccessToken();
|
||||
|
||||
return this.importAlbum(spotifyID, false);
|
||||
|
|
@ -238,7 +240,7 @@ export class SpotifyService {
|
|||
spotifyID
|
||||
);
|
||||
} catch (err) {
|
||||
if (err.response && err.response.status === 401) {
|
||||
if (err.response && err.response.status === 401 && retryOnExpiredToken) {
|
||||
await this.refreshAppAccessToken();
|
||||
|
||||
return this.importArtist(spotifyID, false);
|
||||
|
|
@ -261,6 +263,8 @@ export class SpotifyService {
|
|||
private async refreshAppAccessToken(): Promise<void> {
|
||||
if (!this.appAccessTokenInProgress) {
|
||||
this.logger.debug("refreshing spotify app access token");
|
||||
/* eslint-disable no-async-promise-executor */
|
||||
|
||||
this.appAccessTokenInProgress = new Promise(async (resolve, reject) => {
|
||||
try {
|
||||
const newAccessToken =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue