diff --git a/server-plugins/tags-resources/src/index.ts b/server-plugins/tags-resources/src/index.ts index 9fb608c109..1e65bbe41c 100644 --- a/server-plugins/tags-resources/src/index.ts +++ b/server-plugins/tags-resources/src/index.ts @@ -55,8 +55,12 @@ export async function onTagReference (txes: Tx[], control: TriggerControl): Prom const actualTx = TxProcessor.extractTx(tx) const isCreate = control.hierarchy.isDerived(actualTx._class, core.class.TxCreateDoc) const isRemove = control.hierarchy.isDerived(actualTx._class, core.class.TxRemoveDoc) - if (!isCreate && !isRemove) return [] - if (!control.hierarchy.isDerived((actualTx as TxCUD).objectClass, tags.class.TagReference)) return [] + if (!isCreate && !isRemove) { + continue + } + if (!control.hierarchy.isDerived((actualTx as TxCUD).objectClass, tags.class.TagReference)) { + continue + } if (isCreate) { const doc = TxProcessor.createDoc2Doc(actualTx as TxCreateDoc) result.push( diff --git a/server-plugins/task-resources/src/index.ts b/server-plugins/task-resources/src/index.ts index d39ec634a3..51eb215697 100644 --- a/server-plugins/task-resources/src/index.ts +++ b/server-plugins/task-resources/src/index.ts @@ -24,7 +24,9 @@ export async function OnStateUpdate (txes: Tx[], control: TriggerControl): Promi const result: Tx[] = [] for (const tx of txes) { const actualTx = TxProcessor.extractTx(tx) as TxCUD - if (!control.hierarchy.isDerived(actualTx.objectClass, task.class.Task)) return [] + if (!control.hierarchy.isDerived(actualTx.objectClass, task.class.Task)) { + continue + } if (actualTx._class === core.class.TxCreateDoc) { const doc = TxProcessor.createDoc2Doc(actualTx as TxCreateDoc) const status = control.modelDb.findAllSync(core.class.Status, { _id: doc.status })[0] diff --git a/server/core/src/stats.ts b/server/core/src/stats.ts index 3ede8483e4..c46d65f982 100644 --- a/server/core/src/stats.ts +++ b/server/core/src/stats.ts @@ -102,31 +102,34 @@ export function initStatisticsContext ( const serviceId = encodeURIComponent(os.hostname() + '-' + serviceName) const intTimer = setInterval(() => { - if (metricsFile !== undefined || ops?.logConsole === true) { - const val = metricsToString(metricsContext.metrics, serviceName, 140) - if (val !== oldMetricsValue) { - oldMetricsValue = val - if (metricsFile !== undefined) { - writeFile(metricsFile, val).catch((err) => { - console.error(err) - }) - } - if (ops?.logConsole === true) { - console.info('METRICS:', val) + try { + if (metricsFile !== undefined || ops?.logConsole === true) { + const val = metricsToString(metricsContext.metrics, serviceName, 140) + if (val !== oldMetricsValue) { + oldMetricsValue = val + if (metricsFile !== undefined) { + void writeFile(metricsFile, val).catch((err) => { + console.error(err) + }) + } + if (ops?.logConsole === true) { + console.info('METRICS:', val) + } } } - } - if (statsUrl !== undefined) { - const token = generateToken(systemAccountEmail, { name: '' }, { service: 'true' }) - const data: ServiceStatistics = { - serviceName, - cpu: getCPUInfo(), - memory: getMemoryInfo(), - stats: metricsContext.metrics, - workspaces: ops?.getUsers?.() - } + if (statsUrl !== undefined) { + const token = generateToken(systemAccountEmail, { name: '' }, { service: 'true' }) + const data: ServiceStatistics = { + serviceName, + cpu: getCPUInfo(), + memory: getMemoryInfo(), + stats: metricsContext.metrics, + workspaces: ops?.getUsers?.() + } - try { + const statData = JSON.stringify(data) + + metricsContext.info('send stats:', { size: statData.length }) void fetch( concatLink(statsUrl, '/api/v1/statistics') + `/?token=${encodeURIComponent(token)}&name=${serviceId}`, { @@ -134,19 +137,19 @@ export function initStatisticsContext ( headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(data) + body: statData } ).catch((err) => { errorToSend++ - if (errorToSend % 20 === 0) { + if (errorToSend % 2 === 0) { console.error(err) } }) - } catch (err: any) { - errorToSend++ - if (errorToSend % 20 === 0) { - console.error(err) - } + } + } catch (err: any) { + errorToSend++ + if (errorToSend % 20 === 0) { + console.error(err) } } }, METRICS_UPDATE_INTERVAL) diff --git a/tests/sanity/tests/model/tracker/issues-page.ts b/tests/sanity/tests/model/tracker/issues-page.ts index b2628150ce..52123ff600 100644 --- a/tests/sanity/tests/model/tracker/issues-page.ts +++ b/tests/sanity/tests/model/tracker/issues-page.ts @@ -121,6 +121,11 @@ export class IssuesPage extends CommonTrackerPage { .locator('button') selectPopup = (): Locator => this.page.locator('.selectPopup >> button:has-text("Appleseed John")') + + closePopup = async (): Promise => { + await this.page.locator('.selectPopup').press('Escape') + } + notificationTimeoutSetting = (timeout: string): Promise => { return this.page.evaluate((timeout) => { localStorage.setItem('#platform.notification.timeout', timeout) diff --git a/tests/sanity/tests/tracker/filter.spec.ts b/tests/sanity/tests/tracker/filter.spec.ts index 946e3e24a2..8e5b71a12c 100644 --- a/tests/sanity/tests/tracker/filter.spec.ts +++ b/tests/sanity/tests/tracker/filter.spec.ts @@ -392,7 +392,7 @@ test.describe('Tracker filters tests', () => { }) test('Label filter', async () => { - const filterLabel = 'Filter Label' + const filterLabel = `Filter Label-${generateId(4)}` const labelIssue: NewIssue = { title: `Issue for the Label filter-${generateId()}`, description: 'Issue for the Label filter', @@ -406,7 +406,7 @@ test.describe('Tracker filters tests', () => { await test.step('Check Label filter for exist Label', async () => { await issuesPage.selectFilter('Labels', filterLabel) - await issuesPage.inputSearch().press('Escape') + await issuesPage.closePopup() await issuesPage.checkFilter('Labels', 'is', filterLabel) for await (const issue of iterateLocator(issuesPage.issuesList())) { await expect(issue.locator('div.compression-bar > div.label-box span.label')).toContainText(filterLabel)