mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Dashboard memory warning
This commit is contained in:
15
lib/mem_info.rb
Normal file
15
lib/mem_info.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
class MemInfo
|
||||
|
||||
# Total memory in kb. Only works on systems with /proc/meminfo.
|
||||
# Returns nil if it cannot be determined.
|
||||
def mem_total
|
||||
@mem_total ||= begin
|
||||
if s = `grep MemTotal /proc/meminfo`
|
||||
/(\d+)/.match(s)[0].try(:to_i)
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user