kybus-bot 0.11.0 → 0.11.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 07b049513ef4f14a6c9d7896822a8d62a1f7eccee3df45325d7e5f6eff105abc
4
- data.tar.gz: 259700235d2b8a923fa6dfd706b8e0e30b0546f16575ffb960b9e4f45d0a218c
3
+ metadata.gz: 6027eb3dbf33a839ee3b209eda5c8175a75372a3b03021cf171d07794f9ba1b2
4
+ data.tar.gz: 1271955a903acbbebecec80eca93302f144bd97ec70b93ad6c2d6171381942a7
5
5
  SHA512:
6
- metadata.gz: a66ec612123afc67d7296e405f902beac5bae5849b3de7d1cc538ceadc6cbd62c993a3fd373c7a672592196706d2bd71c5e57feb15256299e1c2d55de2bae38d
7
- data.tar.gz: 887ea27d9d9974ba1621fe9430c483ed072e041019b1d66de17f137f32ddc362033382b914dc0ba7ddb8b18df124efec02634d779c5da2a223ac0f5a21a8391c
6
+ metadata.gz: bee0655c5cc486692a84b0e63cace81b3c0028cd10c88699d486d0e05714acb866f9afc68708b66e1bc3a5c5d94aebc43a04ceb875c99331d7d600faea02d39c
7
+ data.tar.gz: db7c59187ff02ca0931382d4ad49a9483047dff4ac6c55217aa68ffbcc6c6a9caa5ef4d5416b773e0a51c280e019d6865f359cb70f5689b9b127c6401190e0e7
@@ -69,6 +69,11 @@ module Kybus
69
69
  @executor.process_message(parsed)
70
70
  end
71
71
 
72
+ def handle_job(job, args, channel_id)
73
+ @executor.execution_context.load_state!(channel_id)
74
+ @forker.handle_job(job, args)
75
+ end
76
+
72
77
  def run
73
78
  pool.each(&:run)
74
79
  pool.each(&:await)
@@ -26,6 +26,8 @@ module Kybus
26
26
  end
27
27
 
28
28
  class Base
29
+ include Kybus::Logger
30
+
29
31
  def initialize(bot, configs)
30
32
  @configs = configs
31
33
  @bot = bot
@@ -44,6 +46,15 @@ module Kybus
44
46
 
45
47
  invoke(command, arguments, job_definition, dsl)
46
48
  end
49
+
50
+ def handle_job(command, args)
51
+ job_definition = @command_definition[command]
52
+ @bot.dsl.instance_eval do
53
+ @args = args
54
+ instance_eval(&job_definition.block)
55
+ end
56
+ log_info('Job Executed', command:, args:)
57
+ end
47
58
  end
48
59
  end
49
60
  end
@@ -14,7 +14,7 @@ module Kybus
14
14
  super
15
15
  @client = LambdaSQSForker.resource(:sqs)
16
16
  @queue = configs['queue']
17
- @queue_url = @client.get_queue_url(queue_name: @queue)
17
+ @queue_url = @client.get_queue_url(queue_name: @queue).queue_url
18
18
  end
19
19
 
20
20
  def invoke(command, args, _job_definition, dsl)
@@ -28,6 +28,11 @@ module Kybus
28
28
  state: dsl.state.to_h
29
29
  }
30
30
  end
31
+
32
+ def handle_job(command, args)
33
+ log_info('Got job from SQS', command:)
34
+ super
35
+ end
31
36
  end
32
37
 
33
38
  register_forker('sqs', LambdaSQSForker)
@@ -4,13 +4,10 @@ module Kybus
4
4
  module Bot
5
5
  module Forkers
6
6
  class ThreadForker < Base
7
- def invoke(command, args, job_definition, dsl)
7
+ def invoke(command, args, _job_definition, _dsl)
8
8
  Thread.new do
9
- dsl.instance_eval do
10
- @args = args
11
- log_info('Forking job', command:)
12
- instance_eval(&job_definition.block)
13
- end
9
+ log_info('Forking job', command:)
10
+ handle_job(command, args)
14
11
  end
15
12
  end
16
13
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Kybus
4
4
  module Bot
5
- VERSION = '0.11.0'
5
+ VERSION = '0.11.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kybus-bot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gilberto Vargas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-08 00:00:00.000000000 Z
11
+ date: 2024-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kybus-core