Are there plans to support suspending `serialize`/...
# serialization
b
Are there plans to support suspending `serialize`/`deserialize`? I need to make a database/cache call within deserialize to determine which
DeserializationStrategy
should be used depending on a field value.
n
I think that it's better to build a cache in memory. Or simply use blocking code to query the database.
d
Cache in memory is definitely better but it still seems like an odd thing to do.
What are you actually deserializing?
b
I want to deserilize the different PDUs of the Matrix spec. The room version needs to be looked up in a database using the
room_id
. To circumvent it, I think I try to detect the PDUs room version depending on the presence of the
event_id
.
d
For stuff like I'd do two step serialisation. One to get the PDU with JSON then another to deserialise the JSON once I've done the database lookup.
b
I just asked in the matrix community and it seems, that holding the room versions of the room ids in memory is the usual approach here...
d
There's another issue somewhere where the team decided not to support suspending as it would be too expensive for most cases.
👍 1
Ah fair enough that works. All for the sake of type safety.