fix
This commit is contained in:
parent
af4aedf173
commit
865648fe74
2
main.go
2
main.go
|
@ -25,7 +25,7 @@ var DequeueHandler = triggered.RegisterExecute(func(params *triggered.Params[boo
|
|||
params.Shared.Value(func(v any) {
|
||||
|
||||
cs := stateClient.GetNoOPSession()
|
||||
for i := 0; ; i++ {
|
||||
for {
|
||||
|
||||
item, err := stateClient.PopItem(cs, "unity3d")
|
||||
if err != nil {
|
||||
|
|
|
@ -5,49 +5,5 @@ import (
|
|||
)
|
||||
|
||||
func TestQueue(t *testing.T) {
|
||||
// q := make(fusenrender.PriorityQueue[*fusenrender.QueueItem], 0)
|
||||
// heap.Init(&q)
|
||||
|
||||
// // 添加几个item
|
||||
// qitema := &fusenrender.QueueItem{Group: "testa", Priority: 2}
|
||||
// a := &fusenrender.Slice[*fusenrender.QueueItem]{
|
||||
// Key: qitema.GetKey(),
|
||||
// Value: qitema,
|
||||
// }
|
||||
|
||||
// qitemb := &fusenrender.QueueItem{Group: "testa", Priority: 4}
|
||||
// b := &fusenrender.Slice[*fusenrender.QueueItem]{
|
||||
// Key: qitemb.GetKey(),
|
||||
// Value: qitemb,
|
||||
// }
|
||||
|
||||
// qitemc := &fusenrender.QueueItem{Group: "testb", Priority: 3}
|
||||
// c := &fusenrender.Slice[*fusenrender.QueueItem]{
|
||||
// Key: qitemc.GetKey(),
|
||||
// Value: qitemc,
|
||||
// }
|
||||
|
||||
// heap.Push(&q, a)
|
||||
|
||||
// heap.Push(&q, a)
|
||||
|
||||
// heap.Push(&q, a)
|
||||
// heap.Push(&q, b)
|
||||
// heap.Push(&q, c)
|
||||
|
||||
// // 取出最高优先级的item
|
||||
// for len(q) != 0 {
|
||||
// item := heap.Pop(&q).(*fusenrender.QueueItem)
|
||||
// fmt.Printf("%v\n", item)
|
||||
// }
|
||||
|
||||
// 更新某一项的优先级
|
||||
// banana := pq[1] // 拿到banana项
|
||||
// banana.key = []byte("avocado") // 更新key
|
||||
// heap.Fix(&pq, banana.index) // 修复堆
|
||||
|
||||
// // 再取出最高优先级
|
||||
// item = heap.Pop(&pq).(*Item)
|
||||
// fmt.Printf("%s %s\n", item.key, item.value) // "avocado" "香蕉"
|
||||
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ var FsPasser *passer.Passer[sm.Result] = func() *passer.Passer[sm.Result] {
|
|||
}
|
||||
e.Result.Data = d
|
||||
result.Data = d
|
||||
|
||||
if !queue.Empty() {
|
||||
smqueue.counter.Notify(queue.Size())
|
||||
}
|
||||
|
|
31
websocket.go
31
websocket.go
|
@ -9,7 +9,6 @@ import (
|
|||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/474420502/requests"
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/lni/dragonboat/v4"
|
||||
"github.com/lni/dragonboat/v4/client"
|
||||
|
@ -87,15 +86,10 @@ func queueHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
// 打印消息
|
||||
fmt.Printf("source: [%s] 数据 推送到unity [%s]\n", item.Source, raddr)
|
||||
log.Printf("source: [%s] 数据 推送到unity [%s]\n", item.Source, raddr)
|
||||
}
|
||||
}
|
||||
|
||||
type RenderCallback struct {
|
||||
// 定义表单结构体
|
||||
|
||||
}
|
||||
|
||||
type Form struct {
|
||||
UserID int `json:"user_id"`
|
||||
GuestID int `json:"guest_id"`
|
||||
|
@ -119,29 +113,6 @@ type Info struct {
|
|||
Image string `json:"image"`
|
||||
}
|
||||
|
||||
func callbackHandler(w http.ResponseWriter, r *http.Request) {
|
||||
var req RequestCallback
|
||||
json.NewDecoder(r.Body).Decode(&req)
|
||||
|
||||
urlstr := "http://localhost:9900/api/upload/upload-file-base"
|
||||
|
||||
form := requests.M{}
|
||||
form["user_id"] = 0
|
||||
form["guest_id"] = 0
|
||||
form["api_type"] = 2
|
||||
form["upload_bucket"] = 2
|
||||
form["file_key"] = req.Info.TaskID
|
||||
form["file_data"] = req.Info.Image
|
||||
form["meta_data"] = ""
|
||||
|
||||
log.Println(req)
|
||||
|
||||
resp, err := requests.Post(urlstr).SetBodyFormData(form).Execute()
|
||||
log.Println(resp.ContentString(), err)
|
||||
|
||||
// log.Println(req)
|
||||
}
|
||||
|
||||
func pushRenderTaskHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// 1. 读取Body内容
|
||||
body, err := io.ReadAll(r.Body)
|
||||
|
|
Loading…
Reference in New Issue
Block a user