bullmq icon indicating copy to clipboard operation
bullmq copied to clipboard

refactor(job, scripts, backoff): Implement isinstance(...) Python Function for Type Checking

Open RGAlexander216 opened this issue 6 months ago • 8 comments

Use isinstance instead of type for type checking

Why

Use Python's builtin isinstance instead of type for type checking.

How

Changed all type(variable) == str/int to isinstance(variable, str/int).

Additional Notes (Optional)

RGAlexander216 avatar Jun 09 '25 19:06 RGAlexander216

@roggervalf, the test failures don't appear to be related to this P.R.. Is that an accurate assessment? Is the P.R. that you opened yesterday intended to address the underlying issues with the test failures?

RGAlexander216 avatar Jun 10 '25 14:06 RGAlexander216

@roggervalf, the test failures don't appear to be related to this P.R.. Is that an accurate assessment? Is the P.R. that you opened yesterday intended to address the underlying issues with the test failures?

hi @RGAlexander216, yes this change is being covered in my pr

roggervalf avatar Jun 11 '25 03:06 roggervalf

hi @RGAlexander216, yes this change is being covered in my pr

@roggervalf, if your P.R. is merged, can the checks be retried for this P.R.?

RGAlexander216 avatar Jun 12 '25 19:06 RGAlexander216

hey @RGAlexander216 seems like something is wrong in this pr, still failing in our tests. Btw once we release latest change you should be able to try it. Still we are working on fix our releases

roggervalf avatar Jun 13 '25 02:06 roggervalf

@roggervalf

  • GitHub Copilot says that the OSV-Scanner failed likely due to dependency vulnerabilities. I didn't modify any libraries in my P.R., so that is a pre-existing issue and I believe could be the root of two of the three tests that failed.
  • The test of dragonflydb@latest is failing due to what boils down to a comparison in one of the lua scripts that Python's interpreter will handle silently, but is technically incorrect. It's comparing a variable of type boolean to an integer. Python's interpreter will just treat a boolean as a 1 or 0 in this comparison and this particular script is not a part of my P.R., so that is how it is written in the current release.
  • The test of redis@7-alpine is failing due to a 503 service unavailable error when trying to run a function/method named getCacheEntry, which is also causing a timeout issue downstream in the pytest run. This is also not a part of my P.R., so it is a part of the current release.

RGAlexander216 avatar Jun 13 '25 15:06 RGAlexander216

@roggervalf Following up on this. To reiterate, the code modifications I made are not related to the conflicts.

RGAlexander216 avatar Jun 24 '25 14:06 RGAlexander216

@RGAlexander216 Could you also add a test that fails without your fixes but passes with them? otherwise we cannot know if this really is fixing an issue or not.

manast avatar Jun 27 '25 15:06 manast

The original P.R.'s primary change was completely rewritten since this P.R. was opened. I unwittingly merged the current codebase yesterday overwriting the primary objective. However, the changes that are left do implement the "right" way to type check objects in Python. Otherwise there really isn't any purpose this P.R. anymore.

RGAlexander216 avatar Jun 28 '25 00:06 RGAlexander216