fix: resolve review findings — SignalR JWT, enum serialization, TCS leak, thread safety
This commit is contained in:
1 parent
926d866749
commit
d9f5224e21
5 files changed
+22
-5
No files matched your search
@@ -23,13 +23,19 @@ public class KnownFaceConfiguration : IEntityTypeConfiguration<KnownFace>
|
||||
.HasMaxLength(100)
|
||||
.IsUnicode(false);
|
||||
|
||||
// Store float[] as JSONB
|
||||
// Store float[] as JSONB with graceful fallback on corrupt data
|
||||
builder.Property(f => f.Embedding)
|
||||
.HasColumnType("jsonb")
|
||||
.HasConversion(
|
||||
v => JsonSerializer.Serialize(v, JsonOptions),
|
||||
v => JsonSerializer.Deserialize<float[]>(v, JsonOptions) ?? Array.Empty<float>());
|
||||
v => DeserializeEmbedding(v));
|
||||
|
||||
builder.HasIndex(f => f.PersonId);
|
||||
}
|
||||
|
||||
private static float[] DeserializeEmbedding(string json)
|
||||
{
|
||||
try { return JsonSerializer.Deserialize<float[]>(json, JsonOptions) ?? Array.Empty<float>(); }
|
||||
catch (JsonException) { return Array.Empty<float>(); }
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user