Skip to content

Commit

Permalink
chore: v0.100.7
Browse files Browse the repository at this point in the history
  • Loading branch information
caixw committed Dec 22, 2024
1 parent 7ad4800 commit 1077a34
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion cmd/web/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/issue9/config v0.8.0 // indirect
github.com/issue9/conv v1.3.5 // indirect
github.com/issue9/errwrap v0.3.2 // indirect
github.com/issue9/mux/v9 v9.1.1 // indirect
github.com/issue9/mux/v9 v9.1.2 // indirect
github.com/issue9/query/v3 v3.1.3 // indirect
github.com/issue9/scheduled v0.21.3 // indirect
github.com/issue9/sliceutil v0.17.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions cmd/web/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ github.com/issue9/localeutil v0.29.1 h1:C5vxqwcAFa9gzMWDni8KsZ2GYtKD+I20RMlKl78t
github.com/issue9/localeutil v0.29.1/go.mod h1:daxDbw51s4GWKjz6pxhh8baHzWDJEUUcsVrqaKs/A8o=
github.com/issue9/logs/v7 v7.6.4 h1:NFM4oM2ggLPPZNgDb8PAOSqELtJOx7PTwoFd3o814wk=
github.com/issue9/logs/v7 v7.6.4/go.mod h1:6fIj8OABk/qWm1c3E9f9oXe0FWwRyoZNWh449D391Zk=
github.com/issue9/mux/v9 v9.1.1 h1:o+oMKaQA8+90RusjkQw9WUWT5ttfoZTdX6TdlSgCtYM=
github.com/issue9/mux/v9 v9.1.1/go.mod h1:CLtV5ZfIrAmfaC/qxn07wXc3GALI45GYCsdE3c/h9CQ=
github.com/issue9/mux/v9 v9.1.2 h1:Ng5uv8bwsduZV6w14gv0HR78ahBs8Fm0JWlc7Xjtbd4=
github.com/issue9/mux/v9 v9.1.2/go.mod h1:CLtV5ZfIrAmfaC/qxn07wXc3GALI45GYCsdE3c/h9CQ=
github.com/issue9/query/v3 v3.1.3 h1:Y6ETEYXxaKqhpM4lXPKCffhJ72VuKQbrAwgwHlacu0Y=
github.com/issue9/query/v3 v3.1.3/go.mod h1:a/W/+7iel9K+5rRT4AFAKR8+OJeV5axeF6tK9My4lNA=
github.com/issue9/rands/v3 v3.0.1 h1:EnX9WNushGgHCzoL/R5eBPaLfvjLO/c7CGHNgLK0JhY=
Expand Down
14 changes: 10 additions & 4 deletions mimetype/sse/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,11 @@ func (srv *Server[T]) NewSource(sid T, ctx *web.Context) (s *Source, wait func()
srv.sources.Store(sid, s)

go func() {
s.connect(ctx) // 阻塞,出错退出
defer close(s.buf) // 退出之前关闭,防止退出之后,依然有数据源源不断地从 Sent 输入。
s.connect(ctx) // 阻塞,出错退出
defer func() {
close(s.buf) // 退出之前关闭,防止退出之后,依然有数据源源不断地从 Sent 输入。
s.buf = nil
}()
defer srv.sources.Delete(sid) // 如果 connect 返回,说明断开了连接,删除 sources 中的记录。
}()
return s, s.wait
Expand Down Expand Up @@ -231,8 +234,11 @@ func (s *Source) LastEventID() string { return s.lastID }
// Sent 发送消息
//
// id 和 event 都可以为空,表示不需要这些值;
// 如果不想输出 retry 可以输出一个非整数,按照规则客户端会忽略非整数的值;
func (s *Source) Sent(data []string, event, id string) { s.buf <- s.bytes(data, event, id) }
func (s *Source) Sent(data []string, event, id string) {
if s.buf != nil {
s.buf <- s.bytes(data, event, id)
}
}

func (s *Source) bytes(data []string, event, id string) *bytes.Buffer {
if len(data) == 0 {
Expand Down
1 change: 1 addition & 0 deletions server/config/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type mimetypeConfig struct {
// - form
// - html
// - gob
// - yaml
// - nop 没有具体实现的方法,对于上传等需要自行处理的情况可以指定此值。
Target string `json:"target" yaml:"target" xml:"target,attr"`
}
Expand Down
2 changes: 1 addition & 1 deletion web.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

// Version 当前框架的版本
const Version = "0.100.6"
const Version = "0.100.7"

type (
Logger = logs.Logger
Expand Down

0 comments on commit 1077a34

Please sign in to comment.