raes 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/raes.rb +1 -0
- data/lib/raes/use_memory_limit.rb +28 -0
- data/lib/raes/version.rb +1 -1
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9392ed6cf1189aadf25bf2a88a7eae729622dd19a71b33a64d41783e1062fe00
|
4
|
+
data.tar.gz: 327a5cb0c338e933d91e41b0a34b01b5abd975e3d4448a5fa39da9bf5a332398
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95e167c1ff7f4b8a6685643f44ef4592165e1d73332785532866a2b371c9f22ed80cab3c77f101ca8f689626cdbaf28c851a68bc1e408de04a7e285a56fe98c6
|
7
|
+
data.tar.gz: ce567beb27fbcdba14a53450b6e3af91af5f5c344d4581602ed1f9aaf8f0d7860423a85e827cd9c5cbc16051e3a7c19856c8ef7ac0e9e317de6dfbd2285b9b4b
|
data/lib/raes.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Raes
|
4
|
+
module UseMemoryLimit
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
def memsize
|
9
|
+
GetProcessMem.new(Process.pid).mb.ceil
|
10
|
+
end
|
11
|
+
|
12
|
+
def memsize_with_gc
|
13
|
+
size = memsize
|
14
|
+
if !memory_limit.zero? && size > memory_limit
|
15
|
+
GC.start
|
16
|
+
size = memsize
|
17
|
+
end
|
18
|
+
size
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def memory_limit
|
25
|
+
@memory_limit ||= Raes.config.dig(:concern, :memory_limit).to_i
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
data/lib/raes/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: raes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ogom
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -30,6 +30,20 @@ dependencies:
|
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 6.0.3.2
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: get_process_mem
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
33
47
|
- !ruby/object:Gem::Dependency
|
34
48
|
name: factory_bot_rails
|
35
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,6 +118,7 @@ files:
|
|
104
118
|
- lib/raes/reducer.rb
|
105
119
|
- lib/raes/use_caller.rb
|
106
120
|
- lib/raes/use_context_logger.rb
|
121
|
+
- lib/raes/use_memory_limit.rb
|
107
122
|
- lib/raes/use_storage.rb
|
108
123
|
- lib/raes/version.rb
|
109
124
|
- lib/tasks/raes_tasks.rake
|