@@ -98,12 +98,13 @@ export class SandboxWithoutClient extends Disposable {
9898 constructor ( protected pitcherClient : IPitcherClient ) {
9999 super ( ) ;
100100
101- const metricsDisposable = {
102- dispose :
103- this . pitcherClient . clients . system . startMetricsPollingAtInterval ( 5000 ) ,
104- } ;
101+ // TODO: Bring this back once metrics polling does not reset inactivity
102+ // const metricsDisposable = {
103+ // dispose:
104+ // this.pitcherClient.clients.system.startMetricsPollingAtInterval(5000),
105+ // };
105106
106- this . addDisposable ( metricsDisposable ) ;
107+ // this.addDisposable(metricsDisposable);
107108 this . addDisposable ( this . pitcherClient ) ;
108109 }
109110
@@ -123,52 +124,53 @@ export class SandboxWithoutClient extends Disposable {
123124 return `https://codesandbox.io/p/devbox/${ this . id } ` ;
124125 }
125126
126- /**
127- * Get the current system metrics. This return type may change in the future.
128- */
129- public async getMetrics ( ) : Promise < SystemMetricsStatus > {
130- await this . pitcherClient . clients . system . update ( ) ;
131-
132- const barrier = new Barrier < _protocol . system . SystemMetricsStatus > ( ) ;
133- const initialMetrics = this . pitcherClient . clients . system . getMetrics ( ) ;
134- if ( ! initialMetrics ) {
135- const disposable = this . pitcherClient . clients . system . onMetricsUpdated (
136- ( metrics ) => {
137- if ( metrics ) {
138- barrier . open ( metrics ) ;
139- }
140- }
141- ) ;
142- disposable . dispose ( ) ;
143- } else {
144- barrier . open ( initialMetrics ) ;
145- }
146-
147- const barrierResult = await barrier . wait ( ) ;
148- if ( barrierResult . status === "disposed" ) {
149- throw new Error ( "Metrics not available" ) ;
150- }
151-
152- const metrics = barrierResult . value ;
153-
154- return {
155- cpu : {
156- cores : metrics . cpu . cores ,
157- used : metrics . cpu . used / 100 ,
158- configured : metrics . cpu . configured ,
159- } ,
160- memory : {
161- usedKiB : metrics . memory . used * 1024 * 1024 ,
162- totalKiB : metrics . memory . total * 1024 * 1024 ,
163- configuredKiB : metrics . memory . total * 1024 * 1024 ,
164- } ,
165- storage : {
166- usedKB : metrics . storage . used * 1000 * 1000 ,
167- totalKB : metrics . storage . total * 1000 * 1000 ,
168- configuredKB : metrics . storage . configured * 1000 * 1000 ,
169- } ,
170- } ;
171- }
127+ // TODO: Bring this back once metrics polling does not reset inactivity
128+ // /**
129+ // * Get the current system metrics. This return type may change in the future.
130+ // */
131+ // public async getMetrics(): Promise<SystemMetricsStatus> {
132+ // await this.pitcherClient.clients.system.update();
133+
134+ // const barrier = new Barrier<_protocol.system.SystemMetricsStatus>();
135+ // const initialMetrics = this.pitcherClient.clients.system.getMetrics();
136+ // if (!initialMetrics) {
137+ // const disposable = this.pitcherClient.clients.system.onMetricsUpdated(
138+ // (metrics) => {
139+ // if (metrics) {
140+ // barrier.open(metrics);
141+ // }
142+ // }
143+ // );
144+ // disposable.dispose();
145+ // } else {
146+ // barrier.open(initialMetrics);
147+ // }
148+
149+ // const barrierResult = await barrier.wait();
150+ // if (barrierResult.status === "disposed") {
151+ // throw new Error("Metrics not available");
152+ // }
153+
154+ // const metrics = barrierResult.value;
155+
156+ // return {
157+ // cpu: {
158+ // cores: metrics.cpu.cores,
159+ // used: metrics.cpu.used / 100,
160+ // configured: metrics.cpu.configured,
161+ // },
162+ // memory: {
163+ // usedKiB: metrics.memory.used * 1024 * 1024,
164+ // totalKiB: metrics.memory.total * 1024 * 1024,
165+ // configuredKiB: metrics.memory.total * 1024 * 1024,
166+ // },
167+ // storage: {
168+ // usedKB: metrics.storage.used * 1000 * 1000,
169+ // totalKB: metrics.storage.total * 1000 * 1000,
170+ // configuredKB: metrics.storage.configured * 1000 * 1000,
171+ // },
172+ // };
173+ // }
172174
173175 /**
174176 * Disconnect from the sandbox, this does not hibernate the sandbox (but it will
0 commit comments