File tree Expand file tree Collapse file tree 5 files changed +37
-202
lines changed Expand file tree Collapse file tree 5 files changed +37
-202
lines changed Original file line number Diff line number Diff line change 22
22
"depcheck" : " cd packages && pnpm run -r --parallel depcheck" ,
23
23
"prettier-all" : " cd packages/" ,
24
24
"local-ci" : " ./scripts/ci.sh" ,
25
- "conat-server" : " cd packages/server && pnpm conat-server" ,
26
25
"conat-connections" : " cd packages/backend && pnpm conat-connections" ,
27
26
"conat-watch" : " cd packages/backend && pnpm conat-watch" ,
28
27
"conat-inventory" : " cd packages/backend && pnpm conat-inventory"
Original file line number Diff line number Diff line change
1
+ import { loadConatConfiguration } from "./configuration" ;
2
+ import { initPersistServer } from "@cocalc/backend/conat/persist" ;
3
+ import { conatPersistCount } from "@cocalc/backend/data" ;
4
+
5
+ import getLogger from "@cocalc/backend/logger" ;
6
+
7
+ const logger = getLogger ( "server:conat:persist" ) ;
8
+
9
+ export async function initConatPersist ( ) {
10
+ logger . debug ( "initPersistServer: sqlite3 stream persistence" , {
11
+ conatPersistCount,
12
+ } ) ;
13
+ if ( ! conatPersistCount || conatPersistCount <= 1 ) {
14
+ // only 1, so no need to use separate processes
15
+ await loadConatConfiguration ( ) ;
16
+ initPersistServer ( ) ;
17
+ return ;
18
+ }
19
+
20
+ // more than 1 so no possible value to multiple servers if we don't
21
+ // use separate processes
22
+ createPersistCluster ( ) ;
23
+ }
24
+
25
+ async function createPersistCluster ( ) {
26
+ logger . debug (
27
+ "initPersistServer: creating cluster with" ,
28
+ conatPersistCount ,
29
+ "nodes" ,
30
+ ) ;
31
+ await loadConatConfiguration ( ) ;
32
+ for ( let i = 0 ; i < conatPersistCount ; i ++ ) {
33
+ initPersistServer ( ) ;
34
+ }
35
+ }
Load Diff This file was deleted.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 26
26
"./settings" : " ./dist/settings/index.js" ,
27
27
"./settings/*" : " ./dist/settings/*.js"
28
28
},
29
- "keywords" : [
30
- " utilities" ,
31
- " cocalc"
32
- ],
29
+ "keywords" : [" utilities" , " cocalc" ],
33
30
"scripts" : {
34
31
"preinstall" : " npx only-allow pnpm" ,
35
32
"clean" : " rm -rf node_modules dist" ,
36
33
"build" : " ../node_modules/.bin/tsc --build" ,
37
34
"tsc" : " ../node_modules/.bin/tsc --watch --pretty --preserveWatchOutput " ,
38
35
"test" : " TZ=UTC jest --forceExit --runInBand" ,
39
36
"depcheck" : " pnpx depcheck" ,
40
- "prepublishOnly" : " test" ,
41
- "conat-server" : " node ./dist/conat/socketio/cluster.js"
37
+ "prepublishOnly" : " test"
42
38
},
43
39
"author" : " SageMath, Inc." ,
44
40
"license" : " SEE LICENSE.md" ,
You can’t perform that action at this time.
0 commit comments