Code Monkey home page Code Monkey logo

Comments (2)

sorentwo avatar sorentwo commented on July 30, 2024 1

You're correct; the tests are generating an invalid query. There's not much of a reason to assert the scheduled time for something currently available, but I think we can still make it work.

from oban.

smaximov avatar smaximov commented on July 30, 2024

So I've found out that using both state and scheduled_at options forces assert_enqueued/2 to generate the following query:

#Ecto.Query<from j0 in Oban.Job, where: j0.state in ["available", "scheduled"],
 where: fragment(
  "? BETWEEN ? AND ?",
  j0.scheduled_at,
  ^~U[2023-03-22 21:36:32.819404Z],
  ^~U[2023-03-22 21:36:42.819404Z]
),
 where: j0.state == ^"scheduled", where: j0.worker == ^"Worker",
 order_by: [desc: j0.id]>

with an invalid condition state == ^"scheduled". This happens because assert_enqueued/2 builds a Job changeset to process/normalize opts, which in turn would set the scheduled state if opts contain :scheduled_at, effectively overriding the state value given in opts.

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.