Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UBERF-5982: Fix tracker select all action #4950

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions models/server-activity/src/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ async function createDocUpdateMessages (client: MigrationClient): Promise<void>
let processed = 0

async function generateFor (_class: Ref<Class<Doc>>, documents: MigrationIterator<Doc>): Promise<void> {
const classNotFound = new Set<string>()
while (true) {
const docs = await documents.next(50)

Expand All @@ -129,7 +130,11 @@ async function createDocUpdateMessages (client: MigrationClient): Promise<void>
s.add(v.objectId)
byClass.set(_cl, s)
} catch {
console.log('class not found:', v.objectClass)
const has = classNotFound.has(v.objectClass)
if (!has) {
classNotFound.add(v.objectClass)
console.log('class not found:', v.objectClass)
}
continue
}

Expand All @@ -141,7 +146,12 @@ async function createDocUpdateMessages (client: MigrationClient): Promise<void>
s.add(vcol.tx.objectId)
byClass.set(_cl, s)
} catch {
console.log('class not found:', (v as TxCollectionCUD<Doc, AttachedDoc>).tx.objectClass)
const objClass = (v as TxCollectionCUD<Doc, AttachedDoc>).tx.objectClass
const has = classNotFound.has(objClass)
if (!has) {
classNotFound.add(objClass)
console.log('class not found:', objClass)
}
}
}
}
Expand Down Expand Up @@ -172,7 +182,12 @@ async function createDocUpdateMessages (client: MigrationClient): Promise<void>
const innerTx = TxProcessor.extractTx(tx) as TxCUD<Doc>

if (!client.hierarchy.hasClass(innerTx.objectClass)) {
console.log('class not found:', innerTx.objectClass)
const objClass = innerTx.objectClass
const has = classNotFound.has(objClass)
if (!has) {
classNotFound.add(objClass)
console.log('class not found:', objClass)
}
continue
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
const smap = new Map(selected.map((it) => [it._id, it]))
newSelection = newSelection.filter((it) => !smap.has(it._id))
} else {
for (const s of itemsProj.slice(0, selectionLimit)) {
for (const s of items.slice(0, selectionLimit)) {
if (!selectionIds.has(s._id)) {
newSelection.push(s)
}
Expand Down
23 changes: 20 additions & 3 deletions server/backup/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import core, {
DOMAIN_MODEL,
DOMAIN_TRANSIENT,
Ref,
SortingOrder,
TxCollectionCUD,
WorkspaceId
} from '@hcengineering/core'
Expand Down Expand Up @@ -88,6 +89,7 @@ export interface BackupInfo {
version: string
productId: string
snapshots: BackupSnapshot[]
lastTxId?: string
}

async function loadDigest (
Expand Down Expand Up @@ -343,22 +345,37 @@ export async function backup (
let backupInfo: BackupInfo = {
workspace: workspaceId.name,
productId: workspaceId.productId,
version: '0.6.1',
version: '0.6.2',
snapshots: []
}

// Version 0.6.1, format of digest file is changed to
// Version 0.6.2, format of digest file is changed to

const infoFile = 'backup.json.gz'

if (await storage.exists(infoFile)) {
backupInfo = JSON.parse(gunzipSync(await storage.loadFile(infoFile)).toString())
}
backupInfo.version = '0.6.1'
backupInfo.version = '0.6.2'

backupInfo.workspace = workspaceId.name
backupInfo.productId = workspaceId.productId

// Skip backup if there is no transaction changes.
const lastTx = await connection.findOne(
core.class.Tx,
{},
{ limit: 1, sort: { modifiedOn: SortingOrder.Descending } }
)
if (lastTx !== undefined) {
if (lastTx._id === backupInfo.lastTxId) {
console.log('No transaction changes. Skipping backup.')
return
} else {
backupInfo.lastTxId = lastTx._id
}
}

const snapshot: BackupSnapshot = {
date: Date.now(),
domains: {}
Expand Down