Skip to content
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

Encapsulate templating data source and optimize locking #1149

Merged
merged 1 commit into from
Aug 28, 2024

Conversation

tommysitu
Copy link
Member

No description provided.

Comment on lines +43 to +48
func (t *TemplateDataSource) GetDataSource(name string) (*DataSource, bool) {
t.rwMutex.RLock()
defer t.rwMutex.RUnlock()

for _, dataSource := range templateDataSource.DataSources {
if dataSource.Name == name {
return true
}
}
return false
source, exits := t.dataSources[name]
return source, exits
Copy link
Member Author

@tommysitu tommysitu Aug 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ensure safe concurrent access using read lock

@tommysitu tommysitu merged commit 1245f30 into master Aug 28, 2024
4 checks passed
@tommysitu tommysitu deleted the minor-datasource-cleanup branch August 28, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant