File tree Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Expand file tree Collapse file tree 2 files changed +19
-5
lines changed Original file line number Diff line number Diff line change 56
56
"@leafygreen-ui/icon-button" : " ^5.0.2" ,
57
57
"@mongosh/browser-repl" : " 0.0.0-dev.0" ,
58
58
"@mongosh/browser-runtime-electron" : " 0.0.0-dev.0" ,
59
+ "@mongosh/node-runtime-worker-thread" : " 0.0.0-dev.0" ,
59
60
"@mongosh/service-provider-server" : " 0.0.0-dev.0" ,
60
61
"hadron-react-buttons" : " ^4.0.4" ,
61
62
"mongodb-redux-common" : " 0.0.2"
Original file line number Diff line number Diff line change 1
1
import { ElectronRuntime } from '@mongosh/browser-runtime-electron' ;
2
2
import { CompassServiceProvider } from '@mongosh/service-provider-server' ;
3
+ import { WorkerRuntime } from '@mongosh/node-runtime-worker-thread' ;
3
4
4
5
/**
5
6
* The prefix.
@@ -38,17 +39,29 @@ export default function reducer(state = INITIAL_STATE, action) {
38
39
39
40
function reduceSetupRuntime ( state , action ) {
40
41
if ( action . error || ! action . dataService ) {
41
- return { error : action . error , dataService : null , runtime : null } ;
42
+ return { error : action . error , dataService : null , runtime : null } ;
42
43
}
43
44
44
45
if ( state . dataService === action . dataService ) {
45
46
return state ;
46
47
}
47
48
48
- const runtime = new ElectronRuntime (
49
- CompassServiceProvider . fromDataService ( action . dataService ) ,
50
- action . appRegistry
51
- ) ;
49
+ const { url, options } = action . dataService . getConnectionOptions ( ) ;
50
+
51
+ const runtime = ! ! process . env . COMPASS_SHELL_EXPERIMENTAL_WORKER_RUNTIME
52
+ ? new WorkerRuntime (
53
+ url ,
54
+ options ,
55
+ { } ,
56
+ {
57
+ env : { ...process . env , ELECTRON_RUN_AS_NODE : 1 } ,
58
+ serialization : 'advanced' ,
59
+ }
60
+ )
61
+ : new ElectronRuntime (
62
+ CompassServiceProvider . fromDataService ( action . dataService ) ,
63
+ action . appRegistry
64
+ ) ;
52
65
53
66
return {
54
67
error : action . error ,
You can’t perform that action at this time.
0 commit comments