@@ -35,17 +35,6 @@ export async function activate(context: vscode.ExtensionContext) {
35
35
} ) ) ;
36
36
gitpodContext . supervisor . startObservePortsStatus ( ) ;
37
37
38
- // We are moving the heartbeat to gitpod-desktop extension,
39
- // so we register a command to cancel the heartbeat on the gitpod-remote extension
40
- // and then gitpod-desktop will take care of it.
41
- const toDispose = registerHearbeat ( gitpodContext ) ;
42
- context . subscriptions . push ( toDispose ) ;
43
- context . subscriptions . push ( vscode . commands . registerCommand ( '__gitpod.cancelGitpodRemoteHeartbeat' , ( ) => {
44
- toDispose . dispose ( ) ;
45
- gitpodContext ?. logger . info ( '__gitpod.cancelGitpodRemoteHeartbeat command executed' ) ;
46
- return true ;
47
- } ) ) ;
48
-
49
38
registerCLI ( gitpodContext ) ;
50
39
// configure task terminals if Gitpod Code Server is running
51
40
if ( process . env . GITPOD_THEIA_PORT ) {
@@ -97,105 +86,3 @@ export function registerCLI(context: GitpodExtensionContext): void {
97
86
}
98
87
context . environmentVariableCollection . replace ( 'GITPOD_REMOTE_CLI_IPC' , ipcHookCli ) ;
99
88
}
100
-
101
- export function registerHearbeat ( context : GitpodExtensionContext ) : vscode . Disposable {
102
- const disposables : vscode . Disposable [ ] = [ ] ;
103
-
104
- let lastActivity = 0 ;
105
- const updateLastActivitiy = ( ) => {
106
- lastActivity = new Date ( ) . getTime ( ) ;
107
- } ;
108
- const sendHeartBeat = async ( wasClosed ?: true ) => {
109
- const suffix = wasClosed ? 'was closed heartbeat' : 'heartbeat' ;
110
- if ( wasClosed ) {
111
- context . logger . trace ( 'sending ' + suffix ) ;
112
- }
113
- try {
114
- await context . gitpod . server . sendHeartBeat ( { instanceId : context . info . instanceId , wasClosed } ) ;
115
- if ( wasClosed ) {
116
- context . fireAnalyticsEvent ( { eventName : 'ide_close_signal' , properties : { clientKind : 'vscode' } } ) ;
117
- }
118
- } catch ( err ) {
119
- context . logger . error ( `failed to send ${ suffix } :` , err ) ;
120
- console . error ( `failed to send ${ suffix } ` , err ) ;
121
- }
122
- } ;
123
- sendHeartBeat ( ) ;
124
- if ( ! context . devMode ) {
125
- const sendCloseHeartbeat = ( ) => sendHeartBeat ( true ) ;
126
- context . pendingWillCloseSocket . push ( sendCloseHeartbeat ) ;
127
- disposables . push ( {
128
- dispose ( ) {
129
- const idx = context . pendingWillCloseSocket . indexOf ( sendCloseHeartbeat ) ;
130
- if ( idx >= 0 ) {
131
- context . pendingWillCloseSocket . splice ( idx , 1 ) ;
132
- }
133
- }
134
- } ) ;
135
- }
136
-
137
- const activityInterval = 10000 ;
138
- const heartBeatHandle = setInterval ( ( ) => {
139
- if ( lastActivity + activityInterval < new Date ( ) . getTime ( ) ) {
140
- // no activity, no heartbeat
141
- return ;
142
- }
143
- sendHeartBeat ( ) ;
144
- } , activityInterval ) ;
145
-
146
- disposables . push (
147
- {
148
- dispose ( ) {
149
- clearInterval ( heartBeatHandle ) ;
150
- }
151
- } ,
152
- vscode . window . onDidChangeActiveTextEditor ( updateLastActivitiy ) ,
153
- vscode . window . onDidChangeVisibleTextEditors ( updateLastActivitiy ) ,
154
- vscode . window . onDidChangeTextEditorSelection ( updateLastActivitiy ) ,
155
- vscode . window . onDidChangeTextEditorVisibleRanges ( updateLastActivitiy ) ,
156
- vscode . window . onDidChangeTextEditorOptions ( updateLastActivitiy ) ,
157
- vscode . window . onDidChangeTextEditorViewColumn ( updateLastActivitiy ) ,
158
- vscode . window . onDidChangeActiveTerminal ( updateLastActivitiy ) ,
159
- vscode . window . onDidOpenTerminal ( updateLastActivitiy ) ,
160
- vscode . window . onDidCloseTerminal ( updateLastActivitiy ) ,
161
- vscode . window . onDidChangeTerminalState ( updateLastActivitiy ) ,
162
- vscode . window . onDidChangeWindowState ( updateLastActivitiy ) ,
163
- vscode . window . onDidChangeActiveColorTheme ( updateLastActivitiy ) ,
164
- vscode . authentication . onDidChangeSessions ( updateLastActivitiy ) ,
165
- vscode . debug . onDidChangeActiveDebugSession ( updateLastActivitiy ) ,
166
- vscode . debug . onDidStartDebugSession ( updateLastActivitiy ) ,
167
- vscode . debug . onDidReceiveDebugSessionCustomEvent ( updateLastActivitiy ) ,
168
- vscode . debug . onDidTerminateDebugSession ( updateLastActivitiy ) ,
169
- vscode . debug . onDidChangeBreakpoints ( updateLastActivitiy ) ,
170
- vscode . extensions . onDidChange ( updateLastActivitiy ) ,
171
- vscode . languages . onDidChangeDiagnostics ( updateLastActivitiy ) ,
172
- vscode . tasks . onDidStartTask ( updateLastActivitiy ) ,
173
- vscode . tasks . onDidStartTaskProcess ( updateLastActivitiy ) ,
174
- vscode . tasks . onDidEndTask ( updateLastActivitiy ) ,
175
- vscode . tasks . onDidEndTaskProcess ( updateLastActivitiy ) ,
176
- vscode . workspace . onDidChangeWorkspaceFolders ( updateLastActivitiy ) ,
177
- vscode . workspace . onDidOpenTextDocument ( updateLastActivitiy ) ,
178
- vscode . workspace . onDidCloseTextDocument ( updateLastActivitiy ) ,
179
- vscode . workspace . onDidChangeTextDocument ( updateLastActivitiy ) ,
180
- vscode . workspace . onDidSaveTextDocument ( updateLastActivitiy ) ,
181
- vscode . workspace . onDidChangeNotebookDocument ( updateLastActivitiy ) ,
182
- vscode . workspace . onDidSaveNotebookDocument ( updateLastActivitiy ) ,
183
- vscode . workspace . onDidOpenNotebookDocument ( updateLastActivitiy ) ,
184
- vscode . workspace . onDidCloseNotebookDocument ( updateLastActivitiy ) ,
185
- vscode . workspace . onWillCreateFiles ( updateLastActivitiy ) ,
186
- vscode . workspace . onDidCreateFiles ( updateLastActivitiy ) ,
187
- vscode . workspace . onWillDeleteFiles ( updateLastActivitiy ) ,
188
- vscode . workspace . onDidDeleteFiles ( updateLastActivitiy ) ,
189
- vscode . workspace . onWillRenameFiles ( updateLastActivitiy ) ,
190
- vscode . workspace . onDidRenameFiles ( updateLastActivitiy ) ,
191
- vscode . workspace . onDidChangeConfiguration ( updateLastActivitiy ) ,
192
- vscode . languages . registerHoverProvider ( '*' , {
193
- provideHover : ( ) => {
194
- updateLastActivitiy ( ) ;
195
- return null ;
196
- }
197
- } )
198
- ) ;
199
-
200
- return vscode . Disposable . from ( ...disposables ) ;
201
- }
0 commit comments