MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / ping

Function ping

apps/api/src/controllers/misc.controller.ts:430–462  ·  view source on GitHub ↗
(
  request: FastifyRequest<{
    Body: {
      domain: string;
      count: number;
    };
  }>,
  reply: FastifyReply,
)

Source from the content-addressed store, hash-verified

428}
429
430export async function ping(
431 request: FastifyRequest<{
432 Body: {
433 domain: string;
434 count: number;
435 };
436 }>,
437 reply: FastifyReply,
438) {
439 try {
440 await ch.insert({
441 table: TABLE_NAMES.self_hosting,
442 values: [
443 {
444 domain: request.body.domain,
445 count: request.body.count,
446 created_at: formatClickhouseDate(new Date(), true),
447 },
448 ],
449 format: 'JSONEachRow',
450 });
451 reply.status(200).send({
452 message: 'Success',
453 count: request.body.count,
454 domain: request.body.domain,
455 });
456 } catch (error) {
457 request.log.error({ err: error }, 'Failed to insert ping');
458 reply.status(500).send({
459 error: 'Failed to insert ping',
460 });
461 }
462}
463
464export async function stats(request: FastifyRequest, reply: FastifyReply) {
465 const res = await getCache('api:stats', 60 * 60, async () => {

Callers

nothing calls this directly

Calls 3

formatClickhouseDateFunction · 0.90
sendMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected