MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / flush

Method flush

lib/stats.ts:140–159  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

138 }
139
140 private flush() {
141 const toFlush = this._statsQueue;
142 this._statsQueue = [];
143 if (toFlush) {
144 // async write to S3
145 const key = makeKey(new Date(Date.now()));
146 this._s3
147 .put(key, Buffer.from(toFlush.map(x => JSON.stringify(x)).join('\n')), this._path, {
148 redundancy: StorageClass.REDUCED_REDUNDANCY,
149 })
150 .then(() => {})
151 .catch(e => {
152 logger.warn(`Caught exception trying to log compilations to ${key}: ${e}`);
153 });
154 }
155 if (this._flushJob !== undefined) {
156 clearTimeout(this._flushJob);
157 this._flushJob = undefined;
158 }
159 }
160
161 noteCompilation(compilerId: string, request: ParsedRequest, files: FiledataPair[], buildMethod: string): void {
162 this._statsQueue.push(makeSafe(new Date(), compilerId, request, files, buildMethod));

Callers 2

noteCompilationMethod · 0.95
flush_streamFunction · 0.80

Calls 2

makeKeyFunction · 0.85
putMethod · 0.65

Tested by

no test coverage detected