postburner 1.0.0.pre.1 → 1.0.0.pre.2

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: '04239ad84ef1d61fb0b3c4a354690feb9f5f5269ac98bdf2c59d860308f7b15b'
4
- data.tar.gz: a127e7e32934cdc9daffd3ae7320f7153551f1b0b868745be00dfc9818c87398
3
+ metadata.gz: 5195def95321261f581896c066a199022239c6a2c9eb86504d0beb8ce176b111
4
+ data.tar.gz: cf51e2b5f1fd16938d61cc2daa626e08b3340cbe580cfcae1b42d560626fb643
5
5
  SHA512:
6
- metadata.gz: df136f1ddf7d3cbac60c675ed139300af9a727e2e41fa1eee458e4ab891b69f2bf27b67adfb7af59b2731ced69f8431fdf0a7dabcf46397009ff013482729280
7
- data.tar.gz: 4522be7fa74a7dc9cf807a0d7b3f9a0818c183d45eb295d66667dc7c29fea4a1f35a15271d45fdb8b0395d63b0e938a6db52e0195b9ab00b73b50cb446fed88e
6
+ metadata.gz: e8b2e7bbba0c0dc19ddcd5b6747a20aa0e59509fa05211e616b4eacc177bc9881fe2a873eeb407f29a3697cad280525f4dd71b2cfd412b484a876b23689c432c
7
+ data.tar.gz: 7f954cd5c0241e4b9af5a123ac6de7f3482fd4426a7e9f924975fc786b11b1fd48ba2e7d6942f575998ab9fb147e27e0efe0aeb4468e5fc09caa9555a009c527
@@ -6,6 +6,16 @@ class Postburner::InstallGenerator < Rails::Generators::Base
6
6
  install_migration! 'create_postburner_jobs'
7
7
  end
8
8
 
9
+ def copy_config_file
10
+ destination = "config/postburner.yml"
11
+
12
+ if File.exist?(File.join(destination_root, destination))
13
+ say_status "skip", destination, :yellow
14
+ else
15
+ template "config/postburner.yml", destination
16
+ end
17
+ end
18
+
9
19
  def self.next_migration_number(dirname)
10
20
  timestamp = Time.now.utc.strftime("%Y%m%d%H%M%S")
11
21
  stem = timestamp[0..-3]
@@ -0,0 +1,142 @@
1
+ # Postburner Configuration Example
2
+ #
3
+ # Copy this file to config/postburner.yml and customize for your environment.
4
+ #
5
+ # ## Named Workers Configuration
6
+ #
7
+ # Postburner uses named worker configurations to support different deployment patterns:
8
+ # - Single worker: bin/postburner (auto-selects the single worker)
9
+ # - Multiple workers: bin/postburner --worker <name> (must specify which worker)
10
+ #
11
+ # Each worker can have different fork/thread settings and process different queues.
12
+ # This enables running different queue groups in separate OS processes with distinct
13
+ # concurrency profiles.
14
+ #
15
+ # ## Puma-Style Architecture
16
+ #
17
+ # - **forks: 0** = Single process with thread pool (development/staging)
18
+ # - **forks: 1+** = Multiple processes with thread pools (production)
19
+ #
20
+ # Scale by adjusting forks and threads per worker:
21
+ # - Development: forks=0, threads=1 (single-threaded, easiest debugging)
22
+ # - Staging: forks=0, threads=10 (multi-threaded, moderate load)
23
+ # - Production: forks=4, threads=10 (40 concurrent jobs per queue)
24
+ #
25
+
26
+ default: &default
27
+ # Beanstalkd connection URL
28
+ # Override with ENV['BEANSTALK_URL'] if set
29
+ beanstalk_url: <%= ENV['BEANSTALK_URL'] || 'beanstalk://localhost:11300' %>
30
+
31
+ development:
32
+ <<: *default
33
+
34
+ workers:
35
+ default:
36
+ # Single-threaded, single process (simplest for debugging)
37
+ # Defaults: forks=0, threads=1, gc_limit=nil
38
+ queues:
39
+ - default
40
+ - mailers
41
+
42
+ test:
43
+ <<: *default
44
+
45
+ workers:
46
+ default:
47
+ # Test mode uses inline strategies automatically
48
+ # Defaults: forks=0, threads=1, gc_limit=nil
49
+ queues:
50
+ - default
51
+
52
+ staging:
53
+ <<: *default
54
+
55
+ workers:
56
+ default:
57
+ # Multi-threaded, single process (moderate concurrency)
58
+ default_threads: 10
59
+ default_gc_limit: 5000
60
+ queues:
61
+ - critical
62
+ - default
63
+ - mailers
64
+
65
+ production:
66
+ <<: *default
67
+
68
+ # Example 1: Single worker processing all queues with same settings
69
+ # Run: bin/postburner
70
+ #
71
+ # workers:
72
+ # default:
73
+ # default_forks: 4
74
+ # default_threads: 10
75
+ # default_gc_limit: 5000
76
+ # queues:
77
+ # - critical
78
+ # - default
79
+ # - mailers
80
+ # - imports
81
+
82
+ # Example 2: Multiple workers with different concurrency profiles
83
+ # Run separate processes:
84
+ # bin/postburner --worker imports (4 forks, 1 thread each)
85
+ # bin/postburner --worker general (2 forks, 100 threads each)
86
+ #
87
+ workers:
88
+ # Heavy, memory-intensive jobs - more processes, fewer threads
89
+ imports:
90
+ default_forks: 4
91
+ default_threads: 1
92
+ default_gc_limit: 500
93
+ queues:
94
+ - imports
95
+ - data_processing
96
+
97
+ # General jobs - fewer processes, many threads
98
+ general:
99
+ default_forks: 2
100
+ default_threads: 100
101
+ default_gc_limit: 5000
102
+ queues:
103
+ - default
104
+ - mailers
105
+ - notifications
106
+
107
+ # Example 3: Fine-grained control with multiple specialized workers
108
+ # Run separate processes:
109
+ # bin/postburner --worker critical
110
+ # bin/postburner --worker default
111
+ # bin/postburner --worker mailers
112
+ #
113
+ # workers:
114
+ # critical:
115
+ # default_forks: 1
116
+ # default_threads: 1
117
+ # default_gc_limit: 100
118
+ # queues:
119
+ # - critical
120
+ #
121
+ # default:
122
+ # default_forks: 4
123
+ # default_threads: 10
124
+ # default_gc_limit: 5000
125
+ # queues:
126
+ # - default
127
+ #
128
+ # mailers:
129
+ # default_forks: 2
130
+ # default_threads: 5
131
+ # default_gc_limit: 2000
132
+ # queues:
133
+ # - mailers
134
+
135
+ # Global Defaults (can be overridden per worker):
136
+ #
137
+ # default_queue: default # Default queue name (optional)
138
+ # default_priority: 65536 # Lower = higher priority (optional, 0 is highest)
139
+ # default_ttr: 300 # Time-to-run in seconds (optional)
140
+ # default_threads: 1 # Thread count per fork (optional, defaults to 1)
141
+ # default_forks: 0 # Fork count (optional, defaults to 0 = single process)
142
+ # default_gc_limit: nil # Exit after N jobs for restart (optional, nil = no limit)
@@ -58,6 +58,19 @@ module ActiveJob
58
58
  end
59
59
  end
60
60
 
61
+ # Indicates whether the adapter supports enqueuing after transaction commit.
62
+ #
63
+ # Returns true because Postburner uses Beanstalkd (external queue),
64
+ # which means jobs are safely enqueued outside the database transaction.
65
+ # This allows Rails to automatically defer job enqueuing until after
66
+ # the current database transaction commits.
67
+ #
68
+ # @return [Boolean] Always returns true
69
+ #
70
+ def enqueue_after_transaction_commit?
71
+ true
72
+ end
73
+
61
74
  private
62
75
 
63
76
  # Checks if a job should be tracked in PostgreSQL.
@@ -63,7 +63,7 @@ module Postburner
63
63
  # config = Postburner::Configuration.load_yaml('config/postburner.yml', 'production', 'imports')
64
64
  #
65
65
  def self.load_yaml(path, env = 'development', worker_name = nil)
66
- yaml = YAML.load_file(path)
66
+ yaml = YAML.load_file(path, aliases: true)
67
67
  env_config = yaml[env.to_s] || yaml[env.to_sym]
68
68
 
69
69
  raise ArgumentError, "Environment '#{env}' not found in #{path}" unless env_config
@@ -1,3 +1,3 @@
1
1
  module Postburner
2
- VERSION = '1.0.0.pre.1'
2
+ VERSION = '1.0.0.pre.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postburner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.1
4
+ version: 1.0.0.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Smith
@@ -131,6 +131,7 @@ files:
131
131
  - config/routes.rb
132
132
  - lib/generators/postburner/install/USAGE
133
133
  - lib/generators/postburner/install/install_generator.rb
134
+ - lib/generators/postburner/install/templates/config/postburner.yml
134
135
  - lib/generators/postburner/install/templates/migrations/create_postburner_jobs.rb.erb
135
136
  - lib/postburner.rb
136
137
  - lib/postburner/active_job/adapter.rb