soar_auditing_provider 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b51be1b463900ba2715d257a51f3a0cdfa8c460
4
- data.tar.gz: 3ef84c3086184040563844bf10e36c548fb97886
3
+ metadata.gz: 2e5afebbca1923373653a142f02a6a7c5dda6d2f
4
+ data.tar.gz: 1367dbae9df9debc6a777158732b2a41b25baffc
5
5
  SHA512:
6
- metadata.gz: 57cea7784dab0e044ccefb314bef4579b06dddd823a8c7d0883d7628d73db9a1b4ef4f96df3a2d59183ebb6881eaaf5c184912c80ce2a8f3dc72a2e606d3cd90
7
- data.tar.gz: bd2fd69d3e94fbb4dfa9e81779afa17e623a7807e6da60ca3b5595e47cbcfabadd80ed24c5db004535b3e7bd8383e96f01c0b29cc04721e5f469b69f6b23f0e4
6
+ metadata.gz: e8ee231018f389d0754d23327b9c1c20e78422d100a4b3feacce9443368686de6274bae80db18172744d355195f5d0ca2114d66ae33ad7847c4da6e3285325e3
7
+ data.tar.gz: a4914177481c905ca9438302cbd230f1dbf6f22845b6267c92de887a4464c8f50038d158111b55284a179f9c204f618d21da013ae3564e58896feb9a39a3f4ee
@@ -13,6 +13,7 @@ module SoarAuditingProvider
13
13
  def initialize
14
14
  @queue = Queue.new
15
15
  @start_mutex = Mutex.new
16
+ @queue_mutex = Mutex.new
16
17
  initialize_metrics
17
18
  end
18
19
 
@@ -26,20 +27,16 @@ module SoarAuditingProvider
26
27
  end
27
28
 
28
29
  def enqueue(level, data)
29
- if @queue.size < @maximum_queue_size then
30
+ @queue_mutex.synchronize {
31
+ raise AuditingOverflowError if @queue.size >= @maximum_queue_size
30
32
  @queue.push({:level => level, :data => data})
31
- else
32
- raise AuditingOverflowError
33
- end
34
- ensure_worker_is_running
33
+ start
34
+ }
35
35
  end
36
36
 
37
- def start(verbose: false)
37
+ def start
38
38
  @start_mutex.synchronize {
39
- if not running? then
40
- super()
41
- $stderr.puts("Auditing worker was not running and respawned") if verbose
42
- end
39
+ super if not running?
43
40
  }
44
41
  end
45
42
 
@@ -64,11 +61,16 @@ module SoarAuditingProvider
64
61
  failed_before = true
65
62
  retry
66
63
  end
67
- return false #indicates to thread worder that we are not done executing
64
+
65
+ @queue_mutex.synchronize {
66
+ return false if not @queue.empty? #indicates to thread worker that we are not done executing since the queue is not empty
67
+ stop #explicitly stop the thread so that the stop occur automatically along with queue operations.
68
+ return true #indicates to thread worker that we are done executing since the queue is empty
69
+ }
68
70
  end
69
71
 
70
72
  def flush(timeout = 1)
71
- ensure_worker_is_running
73
+ start
72
74
  wait_for_worker_to_clear_queue(timeout)
73
75
  fallback_flush_to_stderr if @queue.size > 0
74
76
  end
@@ -101,10 +103,6 @@ module SoarAuditingProvider
101
103
  $stderr.puts "#{notification}: #{message}"
102
104
  end
103
105
 
104
- def ensure_worker_is_running
105
- start(verbose: true)
106
- end
107
-
108
106
  def ensure_worker_is_stopped
109
107
  attempt_graceful_stop
110
108
  sleep_while_still_running(5)
@@ -1,3 +1,3 @@
1
1
  module SoarAuditingProvider
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soar_auditing_provider
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernst van Graan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-10-10 00:00:00.000000000 Z
12
+ date: 2016-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler