aboutsummaryrefslogtreecommitdiff
path: root/http_handle_gc.go
blob: 83d2e06a782a7ca178e3e2a5570e9e068011ba59 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org>

package main

import (
	"net/http"
	"runtime"
)

// httpHandleGC handles an HTTP request by calling the garbage collector and
// redirecting the user back to the home page.
//
// TODO: This should probably be removed or hidden behind an administrator's
// control panel, in the future.
func httpHandleGC(writer http.ResponseWriter, request *http.Request, _ map[string]any) {
	runtime.GC()
	http.Redirect(writer, request, "/", http.StatusSeeOther)
}