Minimize blocking in Filesystem.getCachedDiskUsage (#53)

This commit is contained in:
CyberKitsune
2020-08-31 20:27:41 -07:00
committed by GitHub
parent 5f1d9ff151
commit d742acf308
8 changed files with 45 additions and 25 deletions

View File

@@ -287,7 +287,7 @@ func postServerCompressFiles(c *gin.Context) {
return
}
if !s.Filesystem.HasSpaceAvailable() {
if !s.Filesystem.HasSpaceAvailable(true) {
c.AbortWithStatusJSON(http.StatusConflict, gin.H{
"error": "This server does not have enough available disk space to generate a compressed archive.",
})
@@ -361,7 +361,7 @@ func postServerUploadFiles(c *gin.Context) {
return
}
if !s.Filesystem.HasSpaceAvailable() {
if !s.Filesystem.HasSpaceAvailable(true) {
c.AbortWithStatusJSON(http.StatusConflict, gin.H{
"error": "This server does not have enough available disk space to accept any file uploads.",
})

View File

@@ -261,7 +261,7 @@ func (h *Handler) HandleInbound(m Message) error {
// Only send the current disk usage if the server is offline, if docker container is running,
// Environment#EnableResourcePolling() will send this data to all clients.
if state == environment.ProcessOfflineState {
_ = h.server.Filesystem.HasSpaceAvailable()
_ = h.server.Filesystem.HasSpaceAvailable(false)
b, _ := json.Marshal(h.server.Proc())
h.SendJson(&Message{