confluentinc / ide-sidecar

Sidecar application used by Confluent for VS Code, as a local proxy for Confluent Cloud, Confluent Platform and local Kafka clusters, to help users build streaming applications.
Apache License 2.0
3 stars 3 forks source link

Cache schema fetch errors by connection ID, SR cluster ID and schema ID #153

Open rohitsanj opened 5 days ago

rohitsanj commented 5 days ago

From https://github.com/confluentinc/ide-sidecar/pull/150/files#r1834988784:

The NativeConsumeStrategy reuses the same RecordDeserializer instance in every SimpleConsumer object it creates, and the RecordDeserialzer is caching error messages by schema ID regardless of the SR cluster. [..] we should cache the error messages by connection ID, SR cluster ID, and schema ID. This may be simpler, and this method could clear the error cache by connection ID.

Cerchie commented 1 day ago

This has been partially addressed by https://github.com/confluentinc/ide-sidecar/pull/150, however, in the process, an opportunity to refactor and create a schemaErrors class with read/write/clear methods was discovered.

This way, the RecordDeserializer can use the supplied cache in schemaErrors, still keyed by Schema ID, and multiple MessageViewerClusterInfoProcessor(s) could find and reuse the same cache instances.

Pull #158 set the stage for this change.