Merge remote-tracking branch 'origin/develop' into staging

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2024-12-13 17:43:17 +07:00
commit bc3cf5ef19
No known key found for this signature in database
GPG Key ID: BD80F68D68D8F7F2
4 changed files with 16 additions and 12 deletions

View File

@ -867,6 +867,10 @@ export async function listWorkspaces (
): Promise<WorkspaceInfo[]> {
decodeToken(ctx, token) // Just verify token is valid
if (region === '') {
region = null
}
return (await db.workspace.find(region != null ? { region } : {}))
.filter((it) => it.disabled !== true)
.map(trimWorkspaceInfo)
@ -903,6 +907,9 @@ export async function countWorkspacesInRegion (
* @public
*/
export async function listWorkspacesRaw (db: AccountDB, region?: string): Promise<Workspace[]> {
if (region === '') {
region = undefined
}
return (await db.workspace.find(region !== undefined ? { region } : {})).filter((it) => it.disabled !== true)
}

View File

@ -1652,6 +1652,7 @@ export async function restore (
storageAdapter?: StorageAdapter
token?: string
progress?: (progress: number) => Promise<void>
cleanIndexState?: boolean
}
): Promise<boolean> {
const infoFile = 'backup.json.gz'
@ -1845,6 +1846,11 @@ export async function restore (
tx.objectSpace = core.space.Workspace
}
}
if (opt.cleanIndexState === true) {
if (d._class === core.class.DocIndexState) {
;(d as DocIndexState).needIndex = true
}
}
}
if (opt.recheck === true) {

View File

@ -347,13 +347,8 @@ export async function doRestoreWorkspace (
bucketName: string,
pipelineFactory: PipelineFactory,
workspaceStorageAdapter: StorageAdapter,
getConfig: (
ctx: MeasureContext,
workspace: WorkspaceIdWithUrl,
branding: Branding | null,
externalStorage: StorageAdapter
) => DbConfiguration,
skipDomains: string[],
cleanIndexState: boolean,
notify?: (progress: number) => Promise<void>
): Promise<boolean> {
rootCtx.warn('\nRESTORE WORKSPACE ', {
@ -374,6 +369,7 @@ export async function doRestoreWorkspace (
skip: new Set(skipDomains),
recheck: true,
storageAdapter: workspaceStorageAdapter,
cleanIndexState,
getConnection: async () => {
if (pipeline === undefined) {
pipeline = await pipelineFactory(ctx, wsUrl, true, () => {}, null)

View File

@ -530,13 +530,8 @@ export class WorkspaceWorker {
opt.backup.bucketName,
pipelineFactory,
workspaceStorageAdapter,
(ctx, workspace, branding, externalStorage) => {
return getConfig(ctx, dbUrl, ctx, {
externalStorage,
disableTriggers: true
})
},
['blob'],
true,
(_p: number) => {
if (progress !== Math.round(_p)) {
progress = Math.round(_p)