diff --git a/models/all/src/index.ts b/models/all/src/index.ts index bf8d68f8cd..d5ce8e8422 100644 --- a/models/all/src/index.ts +++ b/models/all/src/index.ts @@ -370,7 +370,8 @@ export default function buildModel (): Builder { description: github.string.ConfigDescription, enabled: true, beta: false, - icon: github.icon.Github + icon: github.icon.Github, + classFilter: defaultFilter } ], [ diff --git a/packages/core/src/utils.ts b/packages/core/src/utils.ts index 7a661f6f82..bab6b6f31e 100644 --- a/packages/core/src/utils.ts +++ b/packages/core/src/utils.ts @@ -823,7 +823,9 @@ export function pluginFilterTx ( } } } - console.log('exclude plugin', msg) + if (typeof window !== 'undefined') { + console.log('exclude plugin', msg) + } systemTx = systemTx.filter((t) => !totalExcluded.has(t._id)) return systemTx } diff --git a/plugins/client-resources/src/connection.ts b/plugins/client-resources/src/connection.ts index e1d66e4325..264627289b 100644 --- a/plugins/client-resources/src/connection.ts +++ b/plugins/client-resources/src/connection.ts @@ -375,7 +375,9 @@ class Connection implements ClientConnection { this.lastHash = (resp as HelloResponse).lastHash const serverVersion = helloResp.serverVersion - console.log('Connected to server:', serverVersion) + if (typeof window !== 'undefined') { + console.log('Connected to server:', serverVersion) + } if (this.opt?.onHello !== undefined && !this.opt.onHello(serverVersion)) { this.closed = true diff --git a/plugins/client-resources/src/index.ts b/plugins/client-resources/src/index.ts index 61d8bfc9ec..0c88df268f 100644 --- a/plugins/client-resources/src/index.ts +++ b/plugins/client-resources/src/index.ts @@ -196,7 +196,6 @@ function returnClientTxes (txes: Tx[]): Tx[] { 'text-editor:class:TextEditorAction' as Ref>, 'templates:class:TemplateField' as Ref>, 'activity:class:DocUpdateMessageViewlet' as Ref>, - 'core:class:PluginConfiguration' as Ref>, 'core:class:DomainIndexConfiguration' as Ref>, 'view:class:ViewletDescriptor' as Ref>, 'presentation:class:ComponentPointExtension' as Ref>, diff --git a/services/github/pod-github/src/platform.ts b/services/github/pod-github/src/platform.ts index b38b15e5f5..6671bf4129 100644 --- a/services/github/pod-github/src/platform.ts +++ b/services/github/pod-github/src/platform.ts @@ -177,14 +177,17 @@ export class PlatformWorker { triggerCheckWorkspaces = (): void => {} async doSyncWorkspaces (): Promise { + let oldErrors = '' + let sameErrors = 1 + while (!this.canceled) { - let errors = false + let errors: string[] = [] try { errors = await this.checkWorkspaces() } catch (err: any) { Analytics.handleError(err) this.ctx.error('check workspace', err) - errors = true + errors.push(err.message) } await new Promise((resolve) => { this.triggerCheckWorkspaces = () => { @@ -192,10 +195,19 @@ export class PlatformWorker { this.triggerCheckWorkspaces = () => {} resolve() } - if (errors) { + if (errors.length > 0) { + const timeout = 15000 * sameErrors + const ne = errors.join(',') + if (oldErrors === ne) { + if (sameErrors < 25) { + sameErrors++ + } + } else { + oldErrors = ne + } setTimeout(() => { this.triggerCheckWorkspaces() - }, 5000) + }, timeout) } }) } @@ -836,7 +848,7 @@ export class PlatformWorker { return { workspaceInfo, needRecheck: true } } - private async checkWorkspaces (): Promise { + private async checkWorkspaces (): Promise { this.ctx.info('************************* Check workspaces ************************* ', { workspaces: this.clients.size }) @@ -844,7 +856,7 @@ export class PlatformWorker { const toDelete = new Set(this.clients.keys()) const rateLimiter = new RateLimiter(5) - let errors = 0 + const rechecks: string[] = [] let idx = 0 const connecting = new Map() const st = Date.now() @@ -870,7 +882,7 @@ export class PlatformWorker { const { workspaceInfo, needRecheck } = await this.checkWorkspaceIsActive(token, workspace) if (workspaceInfo === undefined) { if (needRecheck) { - errors++ + rechecks.push(workspace) } return } @@ -946,13 +958,12 @@ export class PlatformWorker { total: workspaces.length } ) - errors++ + rechecks.push(workspace) } } catch (e: any) { Analytics.handleError(e) this.ctx.info("Couldn't create WS worker", { workspace, error: e }) - console.error(e) - errors++ + rechecks.push(workspace) } finally { connecting.delete(workspaceInfo.uuid) } @@ -966,7 +977,6 @@ export class PlatformWorker { await rateLimiter.waitProcessing() } catch (e: any) { Analytics.handleError(e) - errors++ } clearInterval(connectingInfo) @@ -986,14 +996,13 @@ export class PlatformWorker { }) } catch (err: any) { Analytics.handleError(err) - errors++ } } } this.ctx.info('************************* Check workspaces done ************************* ', { workspaces: this.clients.size }) - return errors > 0 + return rechecks } getWorkers (): GithubWorker[] { diff --git a/services/github/pod-github/src/sync/issueBase.ts b/services/github/pod-github/src/sync/issueBase.ts index 105eeff5f4..c75ac5ebc0 100644 --- a/services/github/pod-github/src/sync/issueBase.ts +++ b/services/github/pod-github/src/sync/issueBase.ts @@ -200,6 +200,20 @@ export abstract class IssueSyncManagerBase { ) await this.client.diffUpdate(doc, issueData, lastModified, account) this.provider.sync() + } else if (doc === undefined) { + await derivedClient.diffUpdate( + syncData, + { + external, + externalVersion: githubExternalSyncVersion, + needSync: '', + derivedVersion: '', // Check derived changes + lastModified, + lastGithubUser: account, + ...extraSyncUpdate + }, + lastModified + ) } } if (needSync) { diff --git a/services/github/pod-github/src/worker.ts b/services/github/pod-github/src/worker.ts index a127de48f0..027bb3ee9c 100644 --- a/services/github/pod-github/src/worker.ts +++ b/services/github/pod-github/src/worker.ts @@ -1660,6 +1660,11 @@ export class GithubWorker implements IntegrationManager { reconnect(workspace.uuid, event) })) + const githubEnabled = (await client.findOne(core.class.PluginConfiguration, { pluginId: githubId }))?.enabled + if (githubEnabled === false) { + return undefined + } + await GithubWorker.checkIntegrations(client, installations) const worker = new GithubWorker( @@ -1679,12 +1684,12 @@ export class GithubWorker implements IntegrationManager { } catch (err: any) { ctx.error('timeout during to connect', { workspace, error: err }) await client?.close() + return undefined } } static async checkIntegrations (client: Client, installations: Map): Promise { const wsIntegerations = await client.findAll(github.class.GithubIntegration, {}) - for (const intValue of wsIntegerations) { if (!installations.has(intValue.installationId)) { const ops = new TxOperations(client, core.account.System)