Skip to content

Commit

Permalink
Merge pull request #77 from Shopify/defer-enforcing-cursor-serialiabi…
Browse files Browse the repository at this point in the history
…lity
  • Loading branch information
sambostock authored Apr 20, 2021
2 parents 9089825 + cf55ea7 commit 4e4ed66
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@

#### Bug fix

## v1.1.12 (April 19, 2021)

#### Bug fix

- [77](https://github.com/Shopify/job-iteration/pull/77) - Defer enforce cursor be serializable until 2.0.0

## v1.1.11 (April 19, 2021)

#### Bug fix

- [73](https://github.com/Shopify/job-iteration/pull/73) - Enforce cursor be serializable
_This is reverted in 1.1.12 as it breaks behaviour in some apps._

## v1.1.10 (March 30, 2021)

Expand Down
3 changes: 2 additions & 1 deletion lib/job-iteration/iteration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ def iterate_with_enumerator(enumerator, arguments)
arguments = arguments.dup.freeze
found_record = false
enumerator.each do |object_from_enumerator, index|
assert_valid_cursor!(index)
# Deferred until 2.0.0
# assert_valid_cursor!(index)

record_unit_of_work do
found_record = true
Expand Down
2 changes: 1 addition & 1 deletion lib/job-iteration/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module JobIteration
VERSION = "1.1.11"
VERSION = "1.1.12"
end
1 change: 1 addition & 0 deletions test/integration/integration_behaviour.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ module IntegrationBehaviour
end

test "unserializable corruption is prevented" do
skip "Deferred until 2.0.0"
# Cursors are serialized as JSON, but not all objects are serializable.
# time = Time.at(0).utc # => 1970-01-01 00:00:00 UTC
# json = JSON.dump(time) # => "\"1970-01-01 00:00:00 UTC\""
Expand Down
6 changes: 6 additions & 0 deletions test/unit/iteration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,32 +183,38 @@ def foo
end

def test_jobs_using_time_cursor_will_raise
skip("Deferred until 2.0.0")
push(JobWithTimeCursor)
assert_raises_cursor_error { work_one_job }
end

def test_jobs_using_active_record_cursor_will_raise
skip("Deferred until 2.0.0")
refute_nil(Product.first)
push(JobWithActiveRecordCursor)
assert_raises_cursor_error { work_one_job }
end

def test_jobs_using_symbol_cursor_will_raise
skip("Deferred until 2.0.0")
push(JobWithSymbolCursor)
assert_raises_cursor_error { work_one_job }
end

def test_jobs_using_string_subclass_cursor_will_raise
skip("Deferred until 2.0.0")
push(JobWithStringSubclassCursor)
assert_raises_cursor_error { work_one_job }
end

def test_jobs_using_basic_object_cursor_will_raise
skip("Deferred until 2.0.0")
push(JobWithBasicObjectCursor)
assert_raises_cursor_error { work_one_job }
end

def test_jobs_using_complex_but_serializable_cursor_will_not_raise
skip("Deferred until 2.0.0")
push(JobWithComplexCursor)
work_one_job
end
Expand Down

0 comments on commit 4e4ed66

Please sign in to comment.