Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix DDOS of Office.com #4872

Merged
merged 2 commits into from
Jan 21, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/drivers/odsp-driver/src/odspDocumentStorageManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ export class OdspDocumentStorageService implements IDocumentStorageService {
private readonly treesCache: Map<string, ITree> = new Map();

// Save the timeout so we can cancel and reschedule it as needed
private blobCacheTimeout: ReturnType<typeof setTimeout> | undefined;
// private blobCacheTimeout: ReturnType<typeof setTimeout> | undefined;
// If the defer flag is set when the timeout fires, we'll reschedule rather than clear immediately
// This deferral approach is used (rather than clearing/resetting the timer) as current calling patterns trigger
// too many calls to setTimeout/clearTimeout.
private deferBlobCacheClear: boolean = false;
// private deferBlobCacheClear: boolean = false;

private readonly attributesBlobHandles: Set<string> = new Set();

Expand Down Expand Up @@ -229,7 +229,10 @@ export class OdspDocumentStorageService implements IDocumentStorageService {
async (event) => {
const res = await this.epochTracker.fetchResponse(url, { headers }, FetchType.blob);
const blobContent = await res.arrayBuffer();
event.end({ size: blobContent.byteLength });
event.end({
size: blobContent.byteLength,
waitQueueLength: this.epochTracker.rateLimiter.waitQueueLength,
});
return blobContent;
},
);
Expand Down Expand Up @@ -831,6 +834,7 @@ export class OdspDocumentStorageService implements IDocumentStorageService {
* Schedule a timer for clearing the blob cache or defer the current one.
*/
private scheduleClearBlobsCache() {
/*
if (this.blobCacheTimeout !== undefined) {
// If we already have an outstanding timer, just signal that we should defer the clear
this.deferBlobCacheClear = true;
Expand All @@ -849,6 +853,7 @@ export class OdspDocumentStorageService implements IDocumentStorageService {
const blobCacheTimeoutDuration = 10000;
this.blobCacheTimeout = setTimeout(clearCacheOrDefer, blobCacheTimeoutDuration);
}
*/
}

private checkSnapshotUrl() {
Expand Down