Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extensible DefaultConstraintMaker for persistence #416

Merged
merged 2 commits into from
Sep 11, 2022

Conversation

bdargan
Copy link
Contributor

@bdargan bdargan commented Aug 24, 2022

Added a custom constraint that needs a custom constraint maker to ensure deserialized job will contain the default constraints and the custom constraint.

The recently "open" DefaultConstraintMaker couldn't be sub-classed without hitting inaccessible initialiser build error.

class MyConstraintMaker: DefaultConstraintMaker {
  override public func make(from decoder: Decoder) throws -> [CodableConstraint] {
    var constraints: [CodableConstraint] = try super.make(from: decoder)
    if let constraint = try MyCustomConstraint(from: decoder) { constraints.append(constraint) }
    return constraints
  }
}

queueManager = SwiftQueueManagerBuilder(creator: MyJobCreator())
      .set(serializer: DecodableSerializer(maker: MyConstraintMaker()))

@lucas34
Copy link
Owner

lucas34 commented Aug 29, 2022

LGTM

@stale
Copy link

stale bot commented Sep 5, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 5, 2022
@bdargan
Copy link
Contributor Author

bdargan commented Sep 8, 2022

Hey @lucas34, I'm not familiar with the check that failed on Swift / DANGER, do you have any recommendations?

@stale stale bot removed the wontfix label Sep 8, 2022
@lucas34 lucas34 merged commit 263d0a3 into lucas34:master Sep 11, 2022
@github-actions github-actions bot mentioned this pull request Sep 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants