MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / submit

Method submit

static/compiler-service.ts:215–251  ·  view source on GitHub ↗
(request: Record<string, any>)

Source from the content-addressed store, hash-verified

213 }
214
215 public async submit(request: Record<string, any>) {
216 request.allowStoreCodeDebug = this.allowStoreCodeDebug;
217 const jsonRequest = JSON.stringify(request);
218 if (options.doCache && !request.bypassCache) {
219 const cachedResult = this.cache.get(jsonRequest);
220 if (cachedResult) {
221 return {
222 request: request,
223 result: cachedResult,
224 localCacheHit: true,
225 };
226 }
227 }
228 return new Promise((resolve, reject) => {
229 const compilerId = encodeURIComponent(request.compiler);
230 $.ajax({
231 type: 'POST',
232 url: `${this.getBaseUrl()}api/compiler/${compilerId}/compile`,
233 dataType: 'json',
234 contentType: 'application/json',
235 data: jsonRequest,
236 success: result => {
237 if (result?.okToCache && options.doCache) {
238 this.cache.set(jsonRequest, result);
239 }
240 resolve({
241 request: request,
242 result: result,
243 localCacheHit: false,
244 });
245 },
246 error: (jqXHR, textStatus, errorThrown) => {
247 CompilerService.handleRequestError(request, reject, jqXHR, textStatus, errorThrown);
248 },
249 });
250 });
251 }
252
253 public submitCMake(request: Record<string, any>) {
254 request.allowStoreCodeDebug = this.allowStoreCodeDebug;

Callers 3

sendCompileMethod · 0.80
sendCompileMethod · 0.80
compileChildMethod · 0.80

Calls 4

getBaseUrlMethod · 0.95
handleRequestErrorMethod · 0.80
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected