@gitpod/gitpod-protocol 0.1.5-to-code-reading.1 → 0.1.5-to-new-image.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/admin-protocol.d.ts +12 -0
- package/lib/admin-protocol.d.ts.map +1 -1
- package/lib/admin-protocol.js.map +1 -1
- package/lib/analytics.d.ts +4 -5
- package/lib/analytics.d.ts.map +1 -1
- package/lib/context-url.d.ts +18 -5
- package/lib/context-url.d.ts.map +1 -1
- package/lib/context-url.js +58 -5
- package/lib/context-url.js.map +1 -1
- package/lib/context-url.spec.d.ts +2 -0
- package/lib/context-url.spec.d.ts.map +1 -1
- package/lib/context-url.spec.js +25 -4
- package/lib/context-url.spec.js.map +1 -1
- package/lib/gitpod-service.d.ts +19 -0
- package/lib/gitpod-service.d.ts.map +1 -1
- package/lib/gitpod-service.js.map +1 -1
- package/lib/ide-protocol.d.ts +24 -0
- package/lib/ide-protocol.d.ts.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/installation-admin-protocol.d.ts +27 -0
- package/lib/installation-admin-protocol.d.ts.map +1 -0
- package/lib/installation-admin-protocol.js +30 -0
- package/lib/installation-admin-protocol.js.map +1 -0
- package/lib/messaging/error.d.ts +1 -0
- package/lib/messaging/error.d.ts.map +1 -1
- package/lib/messaging/error.js +2 -0
- package/lib/messaging/error.js.map +1 -1
- package/lib/permission.d.ts +7 -1
- package/lib/permission.d.ts.map +1 -1
- package/lib/permission.js +24 -4
- package/lib/permission.js.map +1 -1
- package/lib/protocol.d.ts +11 -2
- package/lib/protocol.d.ts.map +1 -1
- package/lib/protocol.js +12 -4
- package/lib/protocol.js.map +1 -1
- package/lib/teams-projects-protocol.d.ts +3 -0
- package/lib/teams-projects-protocol.d.ts.map +1 -1
- package/lib/teams-projects-protocol.js +7 -0
- package/lib/teams-projects-protocol.js.map +1 -1
- package/lib/util/tracing.d.ts +2 -2
- package/lib/util/tracing.d.ts.map +1 -1
- package/lib/util/tracing.js +13 -12
- package/lib/util/tracing.js.map +1 -1
- package/lib/workspace-cluster.d.ts +9 -7
- package/lib/workspace-cluster.d.ts.map +1 -1
- package/lib/workspace-cluster.js +18 -1
- package/lib/workspace-cluster.js.map +1 -1
- package/lib/workspace-instance.d.ts +19 -0
- package/lib/workspace-instance.d.ts.map +1 -1
- package/package.json +2 -2
- package/pkg-yarn.lock +2 -2
- package/provenance-bundle.jsonl +1 -1
- package/src/admin-protocol.ts +19 -4
- package/src/analytics.ts +4 -6
- package/src/context-url.spec.ts +18 -4
- package/src/context-url.ts +62 -6
- package/src/gitpod-service.ts +23 -0
- package/src/ide-protocol.ts +27 -0
- package/src/index.ts +1 -0
- package/src/installation-admin-protocol.ts +42 -0
- package/src/messaging/error.ts +3 -0
- package/src/permission.ts +22 -3
- package/src/protocol.ts +19 -5
- package/src/teams-projects-protocol.ts +7 -1
- package/src/util/tracing.ts +14 -13
- package/src/workspace-cluster.ts +17 -9
- package/src/workspace-instance.ts +20 -0
- package/lib/messaging/connection-error-handler.d.ts +0 -27
- package/lib/messaging/connection-error-handler.d.ts.map +0 -1
- package/lib/messaging/connection-error-handler.js +0 -34
- package/lib/messaging/connection-error-handler.js.map +0 -1
- package/lib/util/safe-promise.d.ts +0 -11
- package/lib/util/safe-promise.d.ts.map +0 -1
- package/lib/util/safe-promise.js +0 -31
- package/lib/util/safe-promise.js.map +0 -1
- package/src/messaging/connection-error-handler.ts +0 -62
- package/src/util/safe-promise.ts +0 -26
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright (C) 2017 TypeFox and others.
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
|
|
5
|
-
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import { Message } from "vscode-jsonrpc";
|
|
9
|
-
import { log } from '../util/logging';
|
|
10
|
-
|
|
11
|
-
export interface ResolvedConnectionErrorHandlerOptions {
|
|
12
|
-
readonly serverName: string
|
|
13
|
-
/**
|
|
14
|
-
* The maximum amount of errors allowed before stopping the server.
|
|
15
|
-
*/
|
|
16
|
-
readonly maxErrors: number
|
|
17
|
-
/**
|
|
18
|
-
* The maimum amount of restarts allowed in the restart interval.
|
|
19
|
-
*/
|
|
20
|
-
readonly maxRestarts: number
|
|
21
|
-
/**
|
|
22
|
-
* In minutes.
|
|
23
|
-
*/
|
|
24
|
-
readonly restartInterval: number
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type ConnectionErrorHandlerOptions = Partial<ResolvedConnectionErrorHandlerOptions> & {
|
|
28
|
-
readonly serverName: string
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export class ConnectionErrorHandler {
|
|
32
|
-
|
|
33
|
-
protected readonly options: ResolvedConnectionErrorHandlerOptions;
|
|
34
|
-
constructor(options: ConnectionErrorHandlerOptions) {
|
|
35
|
-
this.options = {
|
|
36
|
-
maxErrors: 3,
|
|
37
|
-
maxRestarts: 5,
|
|
38
|
-
restartInterval: 3,
|
|
39
|
-
...options
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
shouldStop(error: Error, message?: Message, count?: number): boolean {
|
|
44
|
-
return !count || count > this.options.maxErrors;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
protected readonly restarts: number[] = [];
|
|
48
|
-
shouldRestart(): boolean {
|
|
49
|
-
this.restarts.push(Date.now());
|
|
50
|
-
if (this.restarts.length <= this.options.maxRestarts) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
const diff = this.restarts[this.restarts.length - 1] - this.restarts[0];
|
|
54
|
-
if (diff <= this.options.restartInterval * 60 * 1000) {
|
|
55
|
-
log.error(`Server ${this.options.serverName} crashed ${this.options.maxRestarts} times in the last ${this.options.restartInterval} minutes. Will not restart`);
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
this.restarts.shift();
|
|
59
|
-
return true;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
}
|
package/src/util/safe-promise.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020 Gitpod GmbH. All rights reserved.
|
|
3
|
-
* Licensed under the GNU Affero General Public License (AGPL).
|
|
4
|
-
* See License-AGPL.txt in the project root for license information.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { log, LogContext } from './logging';
|
|
9
|
-
|
|
10
|
-
export class SafePromise {
|
|
11
|
-
public static catchAndLog<T>(p: Promise<T>, logCtx?: LogContext) {
|
|
12
|
-
return SafePromise.catch(p, (err) => {
|
|
13
|
-
if (logCtx) {
|
|
14
|
-
log.error(logCtx, err);
|
|
15
|
-
} else {
|
|
16
|
-
log.error(err);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
public static catch<T>(p: Promise<T>, handler: (err: any) => void): Promise<T> {
|
|
21
|
-
return p.catch((err) => {
|
|
22
|
-
handler(err);
|
|
23
|
-
return {} as T; // Nobody will ever see this value as the Promise already failed. It's just there to please the compiler
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
}
|