adding note fix sync too long

This commit is contained in:
Rizky 2024-08-14 15:52:02 +07:00
parent 1ac457b38a
commit 5261ec8fc1
2 changed files with 12 additions and 4 deletions

View File

@ -17,6 +17,10 @@ export const _ = {
if (validate(site_id)) {
const mode = is_msgpack ? "binary" : "string";
const public_data = readDirectoryRecursively(
mode,
code.path(site_id, "site", "src", "public")
);
const result = {
layouts: await _db.page.findMany({
where: {
@ -56,10 +60,7 @@ export const _ = {
},
select: { id: true, content_tree: true },
}),
public: readDirectoryRecursively(
mode,
code.path(site_id, "site", "src", "public")
),
public: public_data,
site: await _db.site.findFirst({
where: { id: site_id },
select: {
@ -82,6 +83,7 @@ export const _ = {
core: readDirectoryRecursively(mode, dir.path(`/app/srv/core`)),
},
};
console.log(public_data);
return await gzipAsync(
mode === "binary" ? encode(result) : JSON.stringify(result)

View File

@ -261,6 +261,12 @@ const doAction = async <T>(arg: {
resolve,
timeout: path.startsWith("yjs.")
? setTimeout(() => {
console.error(`Sync too long: `, {
type: SyncType.Action,
code,
args,
argid,
});
w.sync_too_long = true;
}, 10000)
: undefined,