Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Fix diskusage crash on unsupported platforms + add freebsd #829

Merged
merged 3 commits into from
Sep 21, 2019

Conversation

inve1
Copy link
Contributor

@inve1 inve1 commented Sep 14, 2019

When using flood on an unsupported platform, the app wasn't loading because of this exception:

GET /api/activity-stream?historySnapshot=fiveMin 200 1.189 ms - -
TypeError: diskUsage[process.platform] is not a function
    at DiskUsageService.updateDisks (/usr/home/inve1/flood/server/services/diskUsageService.js:99:39)
    at module.exports (/usr/home/inve1/flood/server/middleware/clientActivityStream.js:46:20)
    at Layer.handle [as handle_request] (/usr/home/inve1/flood/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/home/inve1/flood/node_modules/express/lib/router/route.js:137:13)
    at module.exports (/usr/home/inve1/flood/server/middleware/eventStream.js:26:3)
    at Layer.handle [as handle_request] (/usr/home/inve1/flood/node_modules/express/lib/router/layer.js:95:5)
    at next (/usr/home/inve1/flood/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/usr/home/inve1/flood/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/usr/home/inve1/flood/node_modules/express/lib/router/layer.js:95:5)
    at /usr/home/inve1/flood/node_modules/express/lib/router/index.js:281:22

Description

I put in a check for supported platforms on that function. Since the freebsd df output is the same as linux I also added it as a supported platform with a small refactor

A note about the maxBuffer change: My df output is currently 31045 bytes long. In my case this is because of hundreds of rar2fs mounts to make rar downloads plex-friendly. Perhaps filtering filesystems like these before parsing them in node could be an option since the disk usage from these is useless. Don't want to handle this in a bugfix pr though.

Motivation and Context

Flood stopped working on freebsd after I pulled master today

How Has This Been Tested?

Ran it on freebsd

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Member

@jfurrow jfurrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jfurrow jfurrow merged commit 4ffec5c into Flood-UI:master Sep 21, 2019
@noraj
Copy link
Contributor

noraj commented Sep 21, 2019

LGTM : Looks Good To Me (I had to search lol)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants