Skip to content

Commit

Permalink
update @ProtonMail web clients: disable metrics, #696
Browse files Browse the repository at this point in the history
  • Loading branch information
vladimiry committed Nov 7, 2024
1 parent 46c9bc4 commit 956088c
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
5 changes: 5 additions & 0 deletions patches/protonmail/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"url-8.patch",
"drawer-app.patch",
"slug-helper-1.patch",
"metrics-1.patch",
"app-mail.patch"
],
"proton-account": [
Expand All @@ -25,6 +26,7 @@
"url-8.patch",
"drawer-app.patch",
"slug-helper-1.patch",
"metrics-1.patch",
"app-account.patch"
],
"proton-calendar": [
Expand All @@ -39,6 +41,7 @@
"url-8.patch",
"drawer-app.patch",
"slug-helper-1.patch",
"metrics-1.patch",
"app-calendar.patch"
],
"proton-drive": [
Expand All @@ -53,6 +56,7 @@
"url-8.patch",
"drawer-app.patch",
"slug-helper-1.patch",
"metrics-1.patch",
"app-drive.patch"
],
"proton-vpn-settings": [
Expand All @@ -67,6 +71,7 @@
"url-8.patch",
"drawer-app.patch",
"slug-helper-1.patch",
"metrics-1.patch",
"app-vpn-settings.patch"
]
}
78 changes: 78 additions & 0 deletions patches/protonmail/metrics-1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
diff --git a/packages/metrics/lib/MetricsRequestService.ts b/packages/metrics/lib/MetricsRequestService.ts
index 0ca90fbfb8..1aa925bc32 100644
--- a/packages/metrics/lib/MetricsRequestService.ts
+++ b/packages/metrics/lib/MetricsRequestService.ts
@@ -67,67 +67,19 @@ class MetricsRequestService implements IMetricsRequestService {
this._jailCount = 0;
}

- public startBatchingProcess() {
- if (this._intervalId !== null || this._batch === undefined) {
- return;
- }
+ public startBatchingProcess() {}

- // Very naïve progressive backoff
- const frequencyWithIncrementalBackoff = (this._jailCount + 1) * this._batch.frequency;
-
- this._intervalId = setInterval(() => {
- void this.processNextBatch();
- }, frequencyWithIncrementalBackoff);
- }
-
- public stopBatchingProcess() {
- if (this._intervalId === null) {
- return;
- }
-
- clearInterval(this._intervalId);
- this._intervalId = null;
- }
+ public stopBatchingProcess() {}

public async processAllRequests() {
- if (this._requestQueue.length === 0) {
- return;
- }
-
- const itemsToProcess = this._requestQueue;
- this.clearQueue();
-
- try {
- await this.makeRequest(itemsToProcess);
- } catch (error) {
- this.resetBatchingProcess();
- }
- }
-
- public clearQueue() {
- this._requestQueue = [];
- }
-
- public setReportMetrics(reportMetrics: boolean) {
- this._reportMetrics = reportMetrics;
+ return Promise.resolve();
}

- public report(request: MetricsRequest) {
- if (!this._reportMetrics) {
- return;
- }
-
- if (this._batch === undefined) {
- void this.makeRequest([request]).catch(() => {});
- return;
- }
+ public clearQueue() {}

- if (this._intervalId === null) {
- this.startBatchingProcess();
- }
+ public setReportMetrics(reportMetrics: boolean) {}

- this._requestQueue.push(request);
- }
+ public report(request: MetricsRequest) {}

private async processNextBatch() {
if (this._batch === undefined) {

0 comments on commit 956088c

Please sign in to comment.