wait little for submitt channel to update
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/LazyBachelor/LazyPM/internal/models"
|
"github.com/LazyBachelor/LazyPM/internal/models"
|
||||||
"github.com/LazyBachelor/LazyPM/pkg/web/components"
|
"github.com/LazyBachelor/LazyPM/pkg/web/components"
|
||||||
@@ -24,12 +25,8 @@ func SetSubmitChan(ch chan<- struct{}) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func HandleTaskStatus(w http.ResponseWriter, r *http.Request) {
|
func HandleTaskStatus(w http.ResponseWriter, r *http.Request) {
|
||||||
if submitChan != nil {
|
submitChan <- struct{}{}
|
||||||
select {
|
time.Sleep(100 * time.Millisecond)
|
||||||
case submitChan <- struct{}{}:
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
hx := HTMX(r)
|
hx := HTMX(r)
|
||||||
if hx.IsHxRequest() {
|
if hx.IsHxRequest() {
|
||||||
|
|||||||
Reference in New Issue
Block a user