Code Monkey home page Code Monkey logo

Comments (6)

sorentwo avatar sorentwo commented on September 6, 2024 4

@naserca Ultimately, I opted for a centralized change to Job.to_map/1 to handle this consistently across all engines. Now all job changesets are validated during insert_all, and it's not possible to mistakenly insert an invalid changeset.

Note that previously sending a value like max_attempts: 0, priority: -1, queue: "", etc. would have raised a Postgrex error rather than an Ecto error. Yes, this may raise in some unexpected situations, but it's more consistent than before.

from oban.

sorentwo avatar sorentwo commented on September 6, 2024

@naserca The recorded: true segment is missing because the job was invalid, and new/2 applies features in stages. Since the structured stage returned an error, the recorded stage didn't run.

The lack of validation during insert_all is a problem that stems from mimicking how Repo.insert_all behaves. We can't change the default behaviour because it would be a breaking change, but we can add an option to Oban.insert_all/3 to force validation. WDYT?

from oban.

naserca avatar naserca commented on September 6, 2024

I think the insert_all naming (and functionality) while the actual arg is (at least in most cases) a single %Oban.Pro.Workers.Workflow{} struct (and not a bare list of entries as Repo.insert_all expects) might cause confusion and could benefit from something like Oban.insert_workflow or even reusing Oban.insert and Oban.insert!. Curious what you think!

from oban.

sorentwo avatar sorentwo commented on September 6, 2024

Oban is isolated and unaware that Pro exists. We can't add Pro-specific functions to the core Oban module, and Elixir doesn't allow monkey patching (thankfully). Adding an insert_all!/3 variant is a potential alternative.

from oban.

naserca avatar naserca commented on September 6, 2024

insert_all! seems reasonable! similarly my other suggestions were attempts to avoid "use this function but you have to add this option to avoid a bug" in favor of just "use this completely different function."

from oban.

naserca avatar naserca commented on September 6, 2024

thanks @sorentwo! makes sense.

from oban.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.