fix: extend from IntEnum in RequestState to fix serialization#556
Conversation
janbuchar
left a comment
There was a problem hiding this comment.
- let's consider if we want to keep this compatible with crawlee-js, where we store numbers
- we could just use
IntEnumor(str, Enum)- https://docs.pydantic.dev/dev/api/standard_library_types/#enum - I don't want to maintain duplicates of standard library code
I see a slight advantage in serializing it as something more readable, like
Oh, that's good, thanks. |
Yeah, I agree with that. I guess it boils down to whether we want the two formats to be compatible. Frankly, I don't see any advantage in that. |
Ok, let's use |
Just so we're clear, we're both OK with string values, but we're keeping the integers for the sake of compatibility, right? |
|
Could you also incorporate the test changes from cadlagtrader@02a5c6b? |
I already implemented a new test covering this. |
Yeah, I mean just to make it clear that the reported issue is fixed 😄 |
|
We can change the enum in JS version to store numbers, no problems with that. Generally speaking, numbers will be more performant and less memory sensitive than strings, but we already store a lot of stuff in the request object that I doubt this can be measurable. |
...apparently, that's already the case. The performance impact is most likely non-existent, yes. |

Closes: #551