flor 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,12 @@
2
2
  # flor CHANGELOG.md
3
3
 
4
4
 
5
+ ## flor 0.9.4 released 2017-02-09
6
+
7
+ - Allow setting of flor_debug in ENV (FLOR_DEBUG) and in conf
8
+ - Revise Storage#load_exids (distinct/order by problem on MS-SQL)
9
+
10
+
5
11
  ## flor 0.9.3 released 2017-02-07
6
12
 
7
13
  - Rename the head 'tasker' as 'ganger'
@@ -34,7 +34,7 @@ require 'raabro'
34
34
 
35
35
  module Flor
36
36
 
37
- VERSION = '0.9.3'
37
+ VERSION = '0.9.4'
38
38
  end
39
39
 
40
40
  require 'flor/colours'
@@ -51,18 +51,15 @@ module Flor
51
51
  # (before quitting and passing the hand)
52
52
  #
53
53
 
54
- def self.read(s)
55
-
56
- Flor::ConfExecutor.interpret(s)
57
- end
58
-
59
54
  LOG_DBG_KEYS = %w[ dbg msg err src tree tree_rw run ]
60
55
  LOG_ALL_KEYS = %w[ all log sto ] + LOG_DBG_KEYS
61
56
 
62
- def self.read_env
57
+ def self.interpret_flor_debug(v)
58
+
59
+ a = v || ''
60
+ a = a.split(',') if a.is_a?(String)
61
+ a = a.collect(&:strip)
63
62
 
64
- a =
65
- (ENV['FLOR_DEBUG'] || '').split(',')
66
63
  h =
67
64
  a.inject({}) { |h, kv|
68
65
  k, v = kv.split(':')
@@ -87,6 +84,18 @@ module Flor
87
84
  h
88
85
  end
89
86
 
87
+ def self.read(s)
88
+
89
+ h = Flor::ConfExecutor.interpret(s)
90
+
91
+ h.merge!(interpret_flor_debug(h['flor_debug']))
92
+ end
93
+
94
+ def self.read_env
95
+
96
+ interpret_flor_debug(ENV['FLOR_DEBUG'])
97
+ end
98
+
90
99
  def self.get_class(conf, key)
91
100
 
92
101
  if v = conf[key]
@@ -24,6 +24,12 @@
24
24
 
25
25
  module Flor
26
26
 
27
+ # TODO I need levels, ::Logger has them
28
+ # TODO I need log rotation, ::Logger has then
29
+ # TODO I need line heads, ::Logger has them (and @progname)
30
+ # TODO ::Logger has a formatting callback
31
+ # TODO I need simply @out.puts...
32
+
27
33
  class Logger
28
34
 
29
35
  # NB: logger configuration entries start with "log_"
@@ -63,7 +69,6 @@ module Flor
63
69
 
64
70
  if err
65
71
  sts = ' ' * stp.length
66
- lvs = ' ' * (@uni.length + 1 + lvl.length)
67
72
  dig = lvl[0, 1] + Digest::MD5.hexdigest(line)[0, 4]
68
73
  @out.puts("#{stp} #{@uni} #{lvl} #{dig} #{txt}")
69
74
  err.backtrace.each { |lin| @out.puts(" #{dig} #{@uni} #{lin}") }
@@ -74,7 +79,6 @@ module Flor
74
79
 
75
80
  def notify(executor, msg)
76
81
 
77
- # TODO log to outfile
78
82
  if msg['rewritten'] && @unit.conf['log_tree_rw']
79
83
 
80
84
  Flor.print_compact_tree(
@@ -121,14 +121,15 @@ module Flor
121
121
 
122
122
  def load_exids
123
123
 
124
+ # TODO eventually, exclude exids for which there are "loaded" messages
125
+
124
126
  synchronize do
125
127
 
126
128
  @db[:flor_messages]
127
129
  .select(:exid)
130
+ .group(:exid)
128
131
  .where(status: 'created')
129
- .order_by(:ctime)
130
- .distinct
131
- .all
132
+ .order { min(:ctime) }
132
133
  .collect { |r| r[:exid] }
133
134
  end
134
135
 
@@ -229,15 +230,20 @@ module Flor
229
230
 
230
231
  transync do
231
232
 
233
+ mids = []
234
+
232
235
  ms = @db[:flor_messages]
233
236
  .select(:id, :content)
234
237
  .where(status: 'created', exid: exid)
235
- .order_by(:id)
236
- .map { |m| r = from_blob(m[:content]) || {}; r['mid'] = m[:id]; r }
238
+ .order(:id)
239
+ .collect { |m|
240
+ r = from_blob(m[:content]) || {}
241
+ mid = m[:id]; r['mid'] = mid; mids << mid;
242
+ r }
237
243
 
238
244
  @db[:flor_messages]
239
- .where(id: ms.collect { |m| m['mid'] })
240
- .update(status: 'loaded')
245
+ .where(id: mids)
246
+ .update(status: 'loaded', mtime: Time.now)
241
247
  #
242
248
  # flag them as "loaded" so that other scheduler don't pick them
243
249
 
@@ -296,7 +302,7 @@ module Flor
296
302
  timers
297
303
  .select(:id, :content)
298
304
  .where(status: 'active')
299
- .order_by(:id)
305
+ .order(:id)
300
306
  .all
301
307
  end
302
308
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.3
4
+ version: 0.9.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-02-07 00:00:00.000000000 Z
12
+ date: 2017-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: munemo