feat(pipelines): list commit logs 使用直接订阅。

替代了先查询再订阅,确保数据不丢失。
This commit is contained in:
Ivan Li
2021-03-10 21:41:47 +08:00
parent d02cea2115
commit cba4c0464c
6 changed files with 18 additions and 46 deletions

View File

@ -1,21 +1,4 @@
import { LIST_LOGS_DONE, LIST_LOGS_PUB_SUB } from './repos.constants';
import { Resolver, Subscription } from '@nestjs/graphql';
import { LogList } from './dtos/log-list.model';
import { Inject } from '@nestjs/common';
import { PubSub } from 'apollo-server-express';
import { Resolver } from '@nestjs/graphql';
@Resolver()
export class ReposResolver {
constructor(
@Inject(LIST_LOGS_PUB_SUB)
private readonly pubSub: PubSub,
) {}
@Subscription(() => LogList, {
resolve: (value) => {
return value;
},
})
listLogsDone() {
return this.pubSub.asyncIterator(LIST_LOGS_DONE);
}
}
export class ReposResolver {}