upd: remove unused function, fix logger message
This commit is contained in:
parent
bc25b28a4e
commit
486a2ad839
1 changed files with 2 additions and 10 deletions
|
@ -42,14 +42,6 @@ export class ImportNotesProcessorService {
|
||||||
) {
|
) {
|
||||||
this.logger = this.queueLoggerService.logger.createSubLogger('import-notes');
|
this.logger = this.queueLoggerService.logger.createSubLogger('import-notes');
|
||||||
}
|
}
|
||||||
@bindThis
|
|
||||||
private async _keepTweet(tweet: any) {
|
|
||||||
if (!tweet.created_at.endsWith(new Date().getFullYear())) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return !tweet.full_text.startsWith('@');
|
|
||||||
}
|
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
private async uploadFiles(dir: any, user: any) {
|
private async uploadFiles(dir: any, user: any) {
|
||||||
|
@ -84,7 +76,7 @@ export class ImportNotesProcessorService {
|
||||||
|
|
||||||
@bindThis
|
@bindThis
|
||||||
public async process(job: Bull.Job<DbNoteImportJobData>): Promise<void> {
|
public async process(job: Bull.Job<DbNoteImportJobData>): Promise<void> {
|
||||||
this.logger.info(`Importing following of ${job.data.user.id} ...`);
|
this.logger.info(`Starting note import of ${job.data.user.id} ...`);
|
||||||
|
|
||||||
const user = await this.usersRepository.findOneBy({ id: job.data.user.id });
|
const user = await this.usersRepository.findOneBy({ id: job.data.user.id });
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
|
@ -135,7 +127,7 @@ export class ImportNotesProcessorService {
|
||||||
script.runInContext(context);
|
script.runInContext(context);
|
||||||
const tweets = Object.keys(fakeWindow.window.YTD.tweets.part0).reduce((m, key, i, obj) => {
|
const tweets = Object.keys(fakeWindow.window.YTD.tweets.part0).reduce((m, key, i, obj) => {
|
||||||
return m.concat(fakeWindow.window.YTD.tweets.part0[key].tweet);
|
return m.concat(fakeWindow.window.YTD.tweets.part0[key].tweet);
|
||||||
}, []).filter(this._keepTweet);
|
}, []);
|
||||||
this.queueService.createImportTweetsToDbJob(job.data.user, tweets);
|
this.queueService.createImportTweetsToDbJob(job.data.user, tweets);
|
||||||
} finally {
|
} finally {
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
Loading…
Reference in a new issue