feat: jwt performance

This commit is contained in:
DarkSky
2022-07-26 17:11:01 +08:00
parent 3ec95e4377
commit c39814047a
9 changed files with 204 additions and 173 deletions

View File

@@ -115,8 +115,8 @@ async function _initYjsDatabase(
const doc = new Doc({ autoLoad: true, shouldLoad: true });
const idb = await new IndexeddbPersistence(workspace, doc).whenSynced;
const [awareness, ws] = await _initWebsocketProvider(
const idbp = new IndexeddbPersistence(workspace, doc).whenSynced;
const wsp = _initWebsocketProvider(
backend,
workspace,
doc,
@@ -124,6 +124,8 @@ async function _initYjsDatabase(
params
);
const [idb, [awareness, ws]] = await Promise.all([idbp, wsp]);
const binaries = new Doc({ autoLoad: true, shouldLoad: true });
const binariesIdb = await new IndexeddbPersistence(
`${workspace}_binaries`,
@@ -410,6 +412,7 @@ export class YjsAdapter implements AsyncDatabaseAdapter<YjsContentOperation> {
binary?: ArrayBufferLike;
}
): Promise<YjsBlockInstance> {
console.trace('createBlock', options);
const uuid = options.uuid || `affine${nanoid(16)}`;
if (options.type === BlockTypes.binary) {
if (options.binary && options.binary instanceof ArrayBuffer) {

View File

@@ -51,7 +51,7 @@ export function isBlock(obj: any) {
}
export function sleep() {
return new Promise(resolve => setTimeout(resolve, 500));
return new Promise(resolve => setTimeout(resolve, 100));
}
export { BlockEventBus } from './event-bus';