event_sourcery-postgres 0.6.0 → 0.7.0

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
  SHA1:
3
- metadata.gz: c2860efca21f5ae2a7a8ae316ea70db1fcb1aa1e
4
- data.tar.gz: 56fe6bc5b9233ffc8795ba6b37cff8763bf1b166
3
+ metadata.gz: b9e184af03e67f103ea4c76b4cd0715d4061af7b
4
+ data.tar.gz: 8db961c1dec679cc7a2d01e61a7b7fc7373f1b46
5
5
  SHA512:
6
- metadata.gz: 8b1ef120a33fa76da1698f68a063c07293d82ff1a8310682dbf7be812156216c18061ad7fb5706d412d03f60a67dc1dbd33d05637c12891018fb2cdd7cfbbd42
7
- data.tar.gz: 9310dbd856abac2ffe24f9a6b78f1fc3b6baf23ecfdf087fa5e2349210c343a1f4533c876df9fb5e21107cd5e7bf5fd197fe8cc8fbe4a5eea56ce96aa67c7f37
6
+ metadata.gz: ea7e49bc760804f1559bb00924200a76601c0ec75b2111260ae6b738e15df1b83ad04bb58d50c9039a3742ec4fb2e708fc840105f30ca2b0bd9cc2e7a8fcc5dd
7
+ data.tar.gz: 4bb10f468ce4187fc1182a219840ad6099c49ce5d11a0fdcb4dac79e08b50dc86357777aec3364a5eedb1215652f094fe9578615c64eef822bc91165ded02de9
data/CHANGELOG.md CHANGED
@@ -1,10 +1,25 @@
1
1
  # Change Log
2
+
2
3
  All notable changes to this project will be documented in this file.
3
4
 
4
5
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
5
6
  and this project adheres to [Semantic Versioning](http://semver.org/).
6
7
 
7
- ## [0.6.0] - 2018-1-2
8
+ ## [0.7.0] - 2018-05-23
9
+ ### Added
10
+ - Add a `projector_transaction_size` config option to control how many events
11
+ are processed before the transaction is commited. The default value is 1 to
12
+ match the existing behavour.
13
+
14
+ We suggest setting this to match the number of events returned from the event
15
+ store subscription. This is [now configurable](https://github.com/envato/event_sourcery/pull/197)
16
+ in event_sourcery by configuring `subscription_batch_size`.
17
+
18
+ ### Removed
19
+ - Remove upper bound version restriction on `sequel` gem. Now accepts versions
20
+ 5 and higher.
21
+
22
+ ## [0.6.0] - 2018-01-02
8
23
  ### Changed
9
24
 
10
25
  - Only send info log after processing a group of events
@@ -13,11 +28,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
13
28
  - Remove `processes_events` and `projects_events` as these have been [removed
14
29
  in event_sourcery](https://github.com/envato/event_sourcery/pull/161).
15
30
 
16
- ## [0.5.0] - 2017-7-27
31
+ ## [0.5.0] - 2017-07-27
17
32
  - First Version of YARD documentation.
18
33
  - Fix Sequel deprecation by globally loading pg extensions
19
34
 
20
- ## [0.4.0] - 2017-6-21
35
+ ## [0.4.0] - 2017-06-21
21
36
  ### Changed
22
37
  - Reactors store the UUID of the event being processed in the `causation_id`
23
38
  of any emitted events. This replaces the old behaviour of storing id of the
@@ -30,7 +45,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
30
45
  - Added index on the `events` table for `correlation_id` and `causation_id`
31
46
  columns.
32
47
 
33
- ## [0.3.0] - 2017-6-16
48
+ ## [0.3.0] - 2017-06-16
34
49
  ### Changed
35
50
  - The event store persists the event `correlation_id` and `causation_id`.
36
51
  To facilitate this `correlation_id` and `causation_id` columns have been
@@ -40,7 +55,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
40
55
  - The emit_events method now accepts typed events instead of symbols
41
56
  - Remove dynamic emit events methods from reactors (e.g. emit_item_added)
42
57
 
43
- ## [0.2.0] - 2017-6-1
58
+ ## [0.2.0] - 2017-06-01
44
59
  ### Changed
45
60
  - Make `EventSourcery::Postgres::OptimisedEventPollWaiter#shutdown` private
46
61
  - Updated `EventSourcery::Postgres::OptimisedEventPollWaiter#poll` to ensure that `#shutdown!` is run when an error is raised
@@ -49,8 +64,15 @@ or when the loop stops
49
64
  ### Added
50
65
  - Configure projector tracker table name via `EventSourcery::Postgres.configure`
51
66
 
52
- ## [0.1.0] - 2017-5-26
67
+ ## 0.1.0 - 2017-05-26
53
68
  ### Changed
54
69
  - Imported code from the [event_sourcery](https://github.com/envato/event_sourcery).
55
70
  - Postgres related configuration is through `EventSourcery::Postgres.configure`
56
71
  instead of `EventSourcery.configure`.
72
+
73
+ [Unreleased]: https://github.com/envato/event_sourcery-postgres/compare/v0.6.0...HEAD
74
+ [0.6.0]: https://github.com/envato/event_sourcery-postgres/compare/v0.5.0...v0.6.0
75
+ [0.5.0]: https://github.com/envato/event_sourcery-postgres/compare/v0.4.0...v0.5.0
76
+ [0.4.0]: https://github.com/envato/event_sourcery-postgres/compare/v0.3.0...v0.4.0
77
+ [0.3.0]: https://github.com/envato/event_sourcery-postgres/compare/v0.2.0...v0.3.0
78
+ [0.2.0]: https://github.com/envato/event_sourcery-postgres/compare/v0.1.0...v0.2.0
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
 
23
23
  spec.required_ruby_version = '>= 2.2.0'
24
24
 
25
- spec.add_dependency 'sequel', '~> 4.38'
25
+ spec.add_dependency 'sequel', '>= 4.38'
26
26
  spec.add_dependency 'pg'
27
27
  spec.add_dependency 'event_sourcery', '>= 0.14.0'
28
28
  spec.add_development_dependency 'bundler', '~> 1.10'
@@ -8,7 +8,8 @@ module EventSourcery
8
8
  :tracker_table_name,
9
9
  :callback_interval_if_no_new_events,
10
10
  :auto_create_projector_tracker,
11
- :event_tracker
11
+ :event_tracker,
12
+ :projector_transaction_size
12
13
 
13
14
  attr_writer :event_store,
14
15
  :event_source,
@@ -26,6 +27,7 @@ module EventSourcery
26
27
  @callback_interval_if_no_new_events = 10
27
28
  @event_store_database = nil
28
29
  @auto_create_projector_tracker = true
30
+ @projector_transaction_size = 1
29
31
  end
30
32
 
31
33
  def event_store
@@ -17,22 +17,30 @@ module EventSourcery
17
17
 
18
18
  module InstanceMethods
19
19
  def initialize(tracker: EventSourcery::Postgres.config.event_tracker,
20
- db_connection: EventSourcery::Postgres.config.projections_database)
20
+ db_connection: EventSourcery::Postgres.config.projections_database,
21
+ transaction_size: EventSourcery::Postgres.config.projector_transaction_size)
21
22
  @tracker = tracker
22
23
  @db_connection = db_connection
24
+ @transaction_size = transaction_size
23
25
  end
24
26
 
25
27
  private
26
28
 
29
+ attr_reader :transaction_size
30
+
27
31
  def process_events(events, subscription_master)
28
- events.each do |event|
32
+ events.each_slice(transaction_size) do |slice_of_events|
29
33
  subscription_master.shutdown_if_requested
34
+
30
35
  db_connection.transaction do
31
- process(event)
32
- tracker.processed_event(processor_name, event.id)
36
+ slice_of_events.each do |event|
37
+ process(event)
38
+ EventSourcery.logger.debug { "[#{processor_name}] Processed event: #{event.inspect}" }
39
+ end
40
+ tracker.processed_event(processor_name, slice_of_events.last.id)
33
41
  end
34
- EventSourcery.logger.debug { "[#{processor_name}] Processed event: #{event.inspect}" }
35
42
  end
43
+
36
44
  EventSourcery.logger.info { "[#{processor_name}] Processed up to event id: #{events.last.id}" }
37
45
  end
38
46
  end
@@ -1,5 +1,5 @@
1
1
  module EventSourcery
2
2
  module Postgres
3
- VERSION = '0.6.0'.freeze
3
+ VERSION = '0.7.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: event_sourcery-postgres
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Envato
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-02 00:00:00.000000000 Z
11
+ date: 2018-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.38'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '4.38'
27
27
  - !ruby/object:Gem::Dependency