mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-21 03:42:24 +02:00
UBERF-8469: Fix exit from github service (#6921)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -457,6 +457,9 @@ export class CommentSyncManager implements DocSyncManager {
|
||||
repositories: GithubIntegrationRepository[]
|
||||
): Promise<void> {
|
||||
for (const repo of repositories) {
|
||||
if (this.provider.isClosing()) {
|
||||
break
|
||||
}
|
||||
const syncKey = `${repo._id}:comment`
|
||||
if (repo.githubProject === undefined || !repo.enabled || integration.synchronized.has(syncKey)) {
|
||||
if (!repo.enabled) {
|
||||
@@ -487,6 +490,9 @@ export class CommentSyncManager implements DocSyncManager {
|
||||
})
|
||||
try {
|
||||
for await (const data of i) {
|
||||
if (this.provider.isClosing()) {
|
||||
break
|
||||
}
|
||||
const comments: CommentExternalData[] = data.data as any
|
||||
this.ctx.info('retrieve comments for', {
|
||||
repo: repo.name,
|
||||
|
||||
@@ -815,7 +815,7 @@ export abstract class IssueSyncManagerBase {
|
||||
|
||||
// Collect field update.
|
||||
for (const [k, v] of Object.entries(platformUpdate)) {
|
||||
const mapping = target.mappings.find((it) => it.name === k)
|
||||
const mapping = target.mappings.filter((it) => it != null).find((it) => it.name === k)
|
||||
if (mapping === undefined) {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -985,6 +985,9 @@ export class IssueSyncManager extends IssueSyncManagerBase implements DocSyncMan
|
||||
let partsize = 50
|
||||
try {
|
||||
while (true) {
|
||||
if (this.provider.isClosing()) {
|
||||
break
|
||||
}
|
||||
const idsPart = ids.splice(0, partsize)
|
||||
if (idsPart.length === 0) {
|
||||
break
|
||||
@@ -1080,6 +1083,9 @@ export class IssueSyncManager extends IssueSyncManagerBase implements DocSyncMan
|
||||
repositories: GithubIntegrationRepository[]
|
||||
): Promise<void> {
|
||||
for (const repo of repositories) {
|
||||
if (this.provider.isClosing()) {
|
||||
break
|
||||
}
|
||||
const prj = projects.find((it) => repo.githubProject === it._id)
|
||||
if (prj === undefined) {
|
||||
continue
|
||||
@@ -1128,6 +1134,9 @@ export class IssueSyncManager extends IssueSyncManagerBase implements DocSyncMan
|
||||
)
|
||||
try {
|
||||
for await (const data of i) {
|
||||
if (this.provider.isClosing()) {
|
||||
break
|
||||
}
|
||||
const issues: IssueExternalData[] = data.repository.issues.nodes
|
||||
if (issues.some((issue) => issue.url === undefined && Object.keys(issue).length === 0)) {
|
||||
this.ctx.error('empty document content', {
|
||||
|
||||
@@ -376,6 +376,9 @@ export class ProjectsSyncManager implements DocSyncManager {
|
||||
repositories: GithubIntegrationRepository[]
|
||||
): Promise<void> {
|
||||
for (const prj of projects) {
|
||||
if (this.provider.isClosing()) {
|
||||
break
|
||||
}
|
||||
// Wait global project sync
|
||||
await integration.syncLock.get(prj._id)
|
||||
|
||||
@@ -449,6 +452,9 @@ export class ProjectsSyncManager implements DocSyncManager {
|
||||
(it) => it.space === prj._id
|
||||
)
|
||||
for (const m of milestones) {
|
||||
if (this.provider.isClosing()) {
|
||||
break
|
||||
}
|
||||
try {
|
||||
let { projectStructure, wasUpdates } = await this.ctx.withLog(
|
||||
'update project structure',
|
||||
|
||||
@@ -1433,6 +1433,9 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS
|
||||
repositories: GithubIntegrationRepository[]
|
||||
): Promise<void> {
|
||||
for (const repo of repositories) {
|
||||
if (this.provider.isClosing()) {
|
||||
break
|
||||
}
|
||||
const prj = projects.find((it) => repo.githubProject === it._id)
|
||||
if (prj === undefined) {
|
||||
continue
|
||||
@@ -1518,6 +1521,9 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS
|
||||
}
|
||||
)
|
||||
for await (const data of pullRequestIterator) {
|
||||
if (this.provider.isClosing()) {
|
||||
break
|
||||
}
|
||||
const issues: PullRequestExternalData[] = data.repository.pullRequests.nodes
|
||||
this.ctx.info('retrieve pull requests for', {
|
||||
repo: repo.name,
|
||||
|
||||
@@ -60,6 +60,9 @@ export class UsersSyncManager implements DocSyncManager {
|
||||
repositories: GithubIntegrationRepository[]
|
||||
): Promise<void> {
|
||||
for (const repo of repositories) {
|
||||
if (this.provider.isClosing()) {
|
||||
break
|
||||
}
|
||||
const syncKey = `${repo._id}:users`
|
||||
if (
|
||||
repo.githubProject === undefined ||
|
||||
@@ -107,6 +110,9 @@ export class UsersSyncManager implements DocSyncManager {
|
||||
)
|
||||
try {
|
||||
for await (const data of assignableUsersIterator) {
|
||||
if (this.provider.isClosing()) {
|
||||
break
|
||||
}
|
||||
const users: UserInfo[] = data.repository[key]?.nodes ?? []
|
||||
for (const d of users) {
|
||||
if (d.login !== undefined) {
|
||||
|
||||
Reference in New Issue
Block a user