-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FDS-2386] Global client caching, Telemetry auto instruementation #1129
[FDS-2386] Global client caching, Telemetry auto instruementation #1129
Conversation
@@ -1025,6 +1021,7 @@ async def get_async( | |||
if self.path and os.path.isfile(self.path) | |||
else self.path, | |||
md5=self.content_md5, | |||
synapse_client=syn, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the spots that prompted me to make this change
and (existing_folder := await Folder(id=existing_folder_id).get_async()) | ||
and ( | ||
existing_folder := await Folder(id=existing_folder_id).get_async( | ||
synapse_client=synapse_client |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the spots that prompted me to make this change
@@ -338,6 +336,7 @@ async def get_async( | |||
await get_from_entity_factory( | |||
entity_to_update=self, | |||
synapse_id_or_path=entity_id, | |||
synapse_client=synapse_client, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the spots that prompted me to make this change
synapseclient/models/folder.py
Outdated
), | ||
) | ||
|
||
new_folder_id = source_and_destination.get(self.id, None) | ||
if not new_folder_id: | ||
raise SynapseError("Failed to copy folder.") | ||
folder_copy = await ( | ||
await Folder(id=new_folder_id).get_async() | ||
await Folder(id=new_folder_id).get_async(synapse_client=syn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the spots that prompted me to make this change
), | ||
) | ||
|
||
new_project_id = source_and_destination.get(self.id, None) | ||
if not new_project_id: | ||
raise SynapseError("Failed to copy project.") | ||
project_copy = await ( | ||
await Project(id=new_project_id).get_async() | ||
await Project(id=new_project_id).get_async(synapse_client=syn) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the spots that prompted me to make this change
), | ||
) | ||
|
||
new_folder_id = source_and_destination.get(self.id, None) | ||
if not new_folder_id: | ||
raise SynapseError("Failed to copy folder.") | ||
folder_copy = await ( | ||
await Folder(id=new_folder_id).get_async() | ||
await Folder(id=new_folder_id).get_async(synapse_client=syn) | ||
).sync_from_synapse_async( | ||
download_file=False, | ||
synapse_client=synapse_client, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be synapse_client=syn
like above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They end up working the exact same way because of how syn = Synapse.get_client(synapse_client=synapse_client)
is used. However, I made a change here to make this consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last minor comment, apart from that everything looks good pending a passing build🔥
Problem:
synapse_client
to further functions. When I started to disable client caching it was causing a few integration tests within schematic to fail (Note: The code that caused this was only present in an integration test, and not present in any code hit during a production request to schematic).cache_client = False
when creating a new Synapse object. As a result a client can unintentionally be cached.Solution:
Synapse
classTesting: