File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 "github.com/gin-gonic/gin"
55
66 "github.com/pelican-dev/wings/internal/activity"
7+ "github.com/pelican-dev/wings/server"
78)
89
910// BumpActivity records an io event against the resolved server. mounted on
@@ -25,11 +26,13 @@ func BumpActivity() gin.HandlerFunc {
2526 return
2627 }
2728
28- s := ExtractServer (c )
29- if s == nil {
29+ // soft lookup rather than ExtractServer: the signed upload route has no
30+ // server-injecting middleware, so an absent server is a skip, not a panic.
31+ v , ok := c .Get ("server" )
32+ if ! ok {
3033 return
3134 }
3235
33- activity .Global ().RecordIO (s .Id ())
36+ activity .Global ().RecordIO (v .( * server. Server ) .Id ())
3437 }
3538}
Original file line number Diff line number Diff line change @@ -606,6 +606,11 @@ func postServerUploadFiles(c *gin.Context) {
606606 return
607607 }
608608
609+ // this route resolves the server from the upload token rather than a
610+ // server-injecting middleware, so set it on the context for the
611+ // post-handler BumpActivity middleware to record the io against.
612+ c .Set ("server" , s )
613+
609614 form , err := c .MultipartForm ()
610615 if err != nil {
611616 c .AbortWithStatusJSON (http .StatusBadRequest , gin.H {
You can’t perform that action at this time.
0 commit comments