Communicate and handle apub outgoing updates being delayed (#4009)

* Allow icon only status messages such as STATUS_PROCESSING to be displayed

* Add a processing status state for the EditSocialLinks component

* Log warning for the outbound apub channel being full

* Buffer the outbound apub channel so some API requests are less likely to get blocked during handling

* Make the apub outbound request trace-log always occur after being queued.

* Linting fix
This commit is contained in:
mahmed2000
2024-11-30 22:38:00 +00:00
committed by GitHub
parent df028f90cf
commit d9a0d13479
3 changed files with 19 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ var queue chan Job
// InitOutboundWorkerPool starts n go routines that await ActivityPub jobs.
func InitOutboundWorkerPool() {
queue = make(chan Job)
queue = make(chan Job, workerPoolSize*5) // arbitrary buffer value.
// start workers
for i := 1; i <= workerPoolSize; i++ {
@@ -29,8 +29,13 @@ func InitOutboundWorkerPool() {
// AddToOutboundQueue will queue up an outbound http request.
func AddToOutboundQueue(req *http.Request) {
select {
case queue <- Job{req}:
default:
log.Warnln("Outbound ActivityPub job queue is full")
queue <- Job{req} // will block until received by a worker at this point
}
log.Tracef("Queued request for ActivityPub destination %s", req.RequestURI)
queue <- Job{req}
}
func worker(workerID int, queue <-chan Job) {