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:
@@ -19,7 +19,7 @@ var queue chan Job
|
|||||||
|
|
||||||
// InitOutboundWorkerPool starts n go routines that await ActivityPub jobs.
|
// InitOutboundWorkerPool starts n go routines that await ActivityPub jobs.
|
||||||
func InitOutboundWorkerPool() {
|
func InitOutboundWorkerPool() {
|
||||||
queue = make(chan Job)
|
queue = make(chan Job, workerPoolSize*5) // arbitrary buffer value.
|
||||||
|
|
||||||
// start workers
|
// start workers
|
||||||
for i := 1; i <= workerPoolSize; i++ {
|
for i := 1; i <= workerPoolSize; i++ {
|
||||||
@@ -29,8 +29,13 @@ func InitOutboundWorkerPool() {
|
|||||||
|
|
||||||
// AddToOutboundQueue will queue up an outbound http request.
|
// AddToOutboundQueue will queue up an outbound http request.
|
||||||
func AddToOutboundQueue(req *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)
|
log.Tracef("Queued request for ActivityPub destination %s", req.RequestURI)
|
||||||
queue <- Job{req}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func worker(workerID int, queue <-chan Job) {
|
func worker(workerID int, queue <-chan Job) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const FormStatusIndicator: FC<FormStatusIndicatorProps> = ({ status }) =>
|
|||||||
const classes = classNames({
|
const classes = classNames({
|
||||||
'status-container': true,
|
'status-container': true,
|
||||||
[`status-${type}`]: type,
|
[`status-${type}`]: type,
|
||||||
empty: !message,
|
empty: !message && !icon,
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<span className={classes}>
|
<span className={classes}>
|
||||||
|
|||||||
@@ -19,7 +19,12 @@ import {
|
|||||||
DEFAULT_TEXTFIELD_URL_PATTERN,
|
DEFAULT_TEXTFIELD_URL_PATTERN,
|
||||||
} from '../../../../utils/validators';
|
} from '../../../../utils/validators';
|
||||||
import { TextField } from '../../TextField';
|
import { TextField } from '../../TextField';
|
||||||
import { createInputStatus, STATUS_ERROR, STATUS_SUCCESS } from '../../../../utils/input-statuses';
|
import {
|
||||||
|
createInputStatus,
|
||||||
|
STATUS_ERROR,
|
||||||
|
STATUS_PROCESSING,
|
||||||
|
STATUS_SUCCESS,
|
||||||
|
} from '../../../../utils/input-statuses';
|
||||||
import { FormStatusIndicator } from '../../FormStatusIndicator';
|
import { FormStatusIndicator } from '../../FormStatusIndicator';
|
||||||
|
|
||||||
const { Title } = Typography;
|
const { Title } = Typography;
|
||||||
@@ -140,6 +145,11 @@ export default function EditSocialLinks() {
|
|||||||
|
|
||||||
// posts all the variants at once as an array obj
|
// posts all the variants at once as an array obj
|
||||||
const postUpdateToAPI = async (postValue: any) => {
|
const postUpdateToAPI = async (postValue: any) => {
|
||||||
|
if (!displayModal) {
|
||||||
|
// only create the processing status if the modal is inactive
|
||||||
|
resetTimer = null;
|
||||||
|
setSubmitStatus(createInputStatus(STATUS_PROCESSING));
|
||||||
|
}
|
||||||
await postConfigUpdateToAPI({
|
await postConfigUpdateToAPI({
|
||||||
apiPath: API_SOCIAL_HANDLES,
|
apiPath: API_SOCIAL_HANDLES,
|
||||||
data: { value: postValue },
|
data: { value: postValue },
|
||||||
|
|||||||
Reference in New Issue
Block a user