Skip to content

Commit 026d555

Browse files
committed
Merge branch 'master' into conat-supercluster
2 parents 8ca25f3 + 5e72215 commit 026d555

File tree

5 files changed

+50
-78
lines changed

5 files changed

+50
-78
lines changed

src/packages/database/postgres/changefeed-query.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ both all changefeeds and a small interval of time.
1212
const THROTTLE: boolean = true;
1313

1414
// 10ms when running unit tests, still throttle, but make it quick.
15-
// Otherwise, we default to 250ms, which is enough to be massively
15+
// Otherwise, we default to 500ms, which is enough to be massively
1616
// useful, but also not noticed by user.
1717
let THROTTLE_MS: number = process.env.SMC_TEST ? 10 : 500;
1818

src/packages/frontend/conat/client.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ export class ConatClient extends EventEmitter {
303303
args: any[];
304304
timeout?: number;
305305
}) => {
306-
console.log("callHub", { name, args, timeout });
307306
const cn = this.conat();
308307
const subject = `hub.account.${this.client.account_id}.${service}`;
309308
try {

src/packages/next/next.config.js

Lines changed: 36 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const BASE_PATH = process.env.BASE_PATH ?? "/";
55
const basePath = BASE_PATH == "/" ? "" : BASE_PATH;
66

77
const { join, resolve } = require("path");
8-
const withRspack = require("next-rspack");
98

109
// Important! We include resolve('.') and basePath to avoid
1110
// any possibility of multiple cocalc installs or different base
@@ -16,73 +15,41 @@ const cacheDirectory = join(
1615
resolve("."),
1716
);
1817

19-
const removeImports = require("next-remove-imports")();
18+
const config = {
19+
basePath,
20+
env: { BASE_PATH },
21+
eslint: { ignoreDuringBuilds: true },
22+
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
23+
// Webpack breaks without this pg-native alias, even though it's dead code,
24+
// due to how the pg module does package detection internally.
25+
config.resolve.alias["pg-native"] = ".";
26+
// These aliases are so we don't end up with two distinct copies
27+
// of React in our application, since this doesn't work at all!
28+
config.resolve.alias["react"] = resolve(__dirname, "node_modules", "react");
29+
config.resolve.alias["react-dom"] = resolve(
30+
__dirname,
31+
"node_modules",
32+
"react-dom",
33+
);
34+
// Important: return the modified config
35+
return config;
36+
},
37+
// For i18n, see https://nextjs.org/docs/advanced-features/i18n-routing
38+
// We are doing this at all since it improves our Lighthouse accessibility score.
39+
i18n: {
40+
locales: ["en-US"],
41+
defaultLocale: "en-US",
42+
},
43+
poweredByHeader: false,
44+
};
2045

21-
module.exports = withRspack(
22-
removeImports({
23-
basePath,
24-
swcMinify: true, // enable faster RUST-based minifier
25-
env: { BASE_PATH },
26-
reactStrictMode: false, // See https://github.com/ant-design/ant-design/issues/26136
27-
eslint: { ignoreDuringBuilds: true },
28-
// typescript: { ignoreBuildErrors: true },
29-
webpack: (config, { buildId, dev, isServer, defaultLoaders, webpack }) => {
30-
config.cache = {
31-
type: "filesystem",
32-
buildDependencies: {
33-
config: [__filename],
34-
},
35-
cacheDirectory,
36-
};
37-
// Webpack breaks without this pg-native alias, even though it's dead code,
38-
// due to how the pg module does package detection internally.
39-
config.resolve.alias["pg-native"] = ".";
40-
// These aliases are so we don't end up with two distinct copies
41-
// of React in our application, since this doesn't work at all!
42-
config.resolve.alias["react"] = resolve(
43-
__dirname,
44-
"node_modules",
45-
"react",
46-
);
47-
config.resolve.alias["react-dom"] = resolve(
48-
__dirname,
49-
"node_modules",
50-
"react-dom",
51-
);
52-
config.ignoreWarnings = [
53-
// This yargs warning is caused by node-zendesk in the @cocalc/server package
54-
// being a generally bad citizen. Things seem to work fine (we barely use the
55-
// zendesk api anyways).
56-
{ module: /^\.\.\/server\/node_modules\/yargs.*/ },
57-
];
46+
const withRspack = require("next-rspack");
47+
// use NO_RSPACK to build without RSPACK. This is useful on a machine with a lot
48+
// of RAM (and patience) since it supports hot module reloading (so you don't have
49+
// to refresh after making changes).
5850

59-
// Important: return the modified config
60-
return config;
61-
},
62-
experimental: {
63-
// This is because the debug module color support would otherwise log this warning constantly:
64-
// Module not found: ESM packages (supports-color) need to be imported. Use 'import' to
65-
// reference the package instead. https://nextjs.org/docs/messages/import-esm-externals
66-
// esmExternals: "loose", // not supported by turbopack
67-
// We raise largePageDataBytes since this was recently added, and breaks a lot of SSR rendering
68-
// for cocalc share server. By default this is 128 * 1000 = "128KB", and we are changing it to
69-
// 128 * 1000 * 15 = "1MB" for now. TODO: Obviously, it would be nice to fix the root causes of this
70-
// being too big, but that's for another day, since our production website is broken right now.
71-
largePageDataBytes: 128 * 1000 * 10,
72-
// If you click the back button in the browser, it should go back to the previous page and restore the scroll position.
73-
// With Next.js in the loop, this doesn't happen by default.
74-
// besides the ticket about this, here is a blogpost about this
75-
// https://www.joshwcomeau.com/react/nextjs-scroll-restoration/
76-
scrollRestoration: true,
77-
// https://nextjs.org/docs/app/building-your-application/optimizing/memory-usage#webpack-build-worker
78-
webpackBuildWorker: true,
79-
},
80-
// For i18n, see https://nextjs.org/docs/advanced-features/i18n-routing
81-
// We are doing this at all since it improves our Lighthouse accessibility score.
82-
i18n: {
83-
locales: ["en-US"],
84-
defaultLocale: "en-US",
85-
},
86-
poweredByHeader: false, // https://github.com/sagemathinc/cocalc/issues/6101
87-
}),
88-
);
51+
if (process.env.NO_RSPACK) {
52+
module.exports = config;
53+
} else {
54+
module.exports = withRspack(config);
55+
}

src/packages/sync/editor/generic/sync-doc.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,8 +1460,8 @@ export class SyncDoc extends EventEmitter {
14601460
this.assert_not_closed("initAll -- before ensuring syncstring exists");
14611461
await this.ensure_syncstring_exists_in_db();
14621462

1463-
await this.init_syncstring_table(),
1464-
this.assert_not_closed("initAll -- successful init_syncstring_table");
1463+
await this.init_syncstring_table();
1464+
this.assert_not_closed("initAll -- successful init_syncstring_table");
14651465

14661466
log("patch_list, cursors, evaluator, ipywidgets");
14671467
this.assert_not_closed(
@@ -1504,7 +1504,7 @@ export class SyncDoc extends EventEmitter {
15041504
// this will finish.
15051505
// if (!this.client.is_browser() && !this.client.is_project()) {
15061506
// // FAKE DELAY!!! Just to simulate flakiness / slow network!!!!
1507-
// await delay(10000);
1507+
// await delay(3000);
15081508
// }
15091509
await retry_until_success({
15101510
f: this.init_load_from_disk,
@@ -1563,22 +1563,28 @@ export class SyncDoc extends EventEmitter {
15631563
}
15641564
}
15651565

1566+
let init;
15661567
const is_init = (t: SyncTable) => {
15671568
this.assert_not_closed("is_init");
15681569
const tbl = t.get_one();
15691570
if (tbl == null) {
15701571
dbg("null");
15711572
return false;
15721573
}
1573-
return tbl.get("init") != null;
1574+
init = tbl.get("init")?.toJS();
1575+
return init != null;
15741576
};
15751577
dbg("waiting for init...");
1576-
const init = await this.syncstring_table.wait(is_init, 0);
1578+
await this.syncstring_table.wait(is_init, 0);
15771579
dbg("init done");
15781580
if (init.error) {
15791581
throw Error(init.error);
15801582
}
15811583
assertDefined(this.patch_list);
1584+
if (init.size == null) {
1585+
// don't crash but warn at least.
1586+
console.warn("SYNC BUG -- init.size must be defined", { init });
1587+
}
15821588
if (
15831589
!this.client.is_project() &&
15841590
this.patch_list.count() === 0 &&
@@ -2937,8 +2943,8 @@ export class SyncDoc extends EventEmitter {
29372943
size = data.length;
29382944
dbg(`got it -- length=${size}`);
29392945
this.from_str(data);
2940-
// we also know that this is the version on disk, so we update the hash
29412946
this.commit();
2947+
// we also know that this is the version on disk, so we update the hash
29422948
await this.set_save({
29432949
state: "done",
29442950
error: "",

src/packages/util/smc-version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
/* autogenerated by the update_version script */
2-
exports.version=1750777285;
2+
exports.version=1751049898;

0 commit comments

Comments
 (0)