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
@@ -82,6 +82,7 @@ export abstract class ServiceBaseClass {
workspace: string,
blockId: string
): Promise<BlockImplInstance | undefined> {
if (!blockId) return undefined;
const db = await this.database.getDatabase(workspace);
const db_block = await db.get(blockId as 'block');
if (db_block.id !== blockId) {
@@ -19,7 +19,7 @@ const loading = new Set();
const waitLoading = async (key: string) => {
while (loading.has(key)) {
await sleep();
await sleep(50);
}
};
@@ -53,7 +53,6 @@ async function _getBlockDatabase(
if (!workspaces[workspace]) {
loading.add(workspace);
workspaces[workspace] = await BlockClient.init(workspace, {
...options,
token: await _getCurrentToken(),