Skip to content

Commit 2007e46

Browse files
authored
fix: connection key not working (#312)
1 parent 4e53b03 commit 2007e46

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

api/src/logic/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,11 @@ async fn get_connection(
336336
) -> Result<Arc<Connection>, PicaError> {
337337
let connection = cache
338338
.get_or_insert_with_filter(
339-
&(access.ownership.id.clone(), connection_key.clone()),
339+
&(access.ownership.id.clone().to_string()
340+
+ connection_key.clone().to_str().map_err(|e| {
341+
tracing::error!("Error converting connection key to string: {e}");
342+
ApplicationError::bad_request("Invalid connection key header", None)
343+
})?),
340344
stores.connection.clone(),
341345
doc! {
342346
"key": connection_key.to_str().map_err(|_| {

cache/src/local.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ where
141141
}
142142

143143
type ConnectionModelSchemaKey = (Arc<str>, Arc<str>);
144-
type ConnectionHeaderKey = (Arc<str>, HeaderValue);
144+
// type ConnectionHeaderKey = (Arc<str>, HeaderValue);
145145
type ConnectionKey = Arc<str>;
146146

147147
pub type EventAccessCache = GenericCache<HeaderValue, EventAccess>;
@@ -152,6 +152,6 @@ pub type ConnectionModelDefinitionDestinationCache =
152152
GenericCache<Destination, ConnectionModelDefinition>;
153153
pub type ConnectionModelDefinitionCacheIdKey = GenericCache<Id, ConnectionModelDefinition>;
154154
pub type ConnectionDefinitionCache = GenericCache<Id, ConnectionDefinition>;
155-
pub type ConnectionHeaderCache = GenericCache<ConnectionHeaderKey, Connection>;
155+
pub type ConnectionHeaderCache = GenericCache<String, Connection>;
156156
pub type ConnectionCache = GenericCache<ConnectionKey, Connection>;
157157
pub type ConnectionModelDefinitionCacheStringKey = GenericCache<String, Option<SparseCMD>>;

0 commit comments

Comments
 (0)