Skip to content

Encapsulate templating data source and optimize locking#1149

Merged
tommysitu merged 1 commit intomasterfrom
minor-datasource-cleanup
Aug 28, 2024
Merged

Encapsulate templating data source and optimize locking#1149
tommysitu merged 1 commit intomasterfrom
minor-datasource-cleanup

Conversation

@tommysitu
Copy link
Copy Markdown
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
Copy Markdown
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
@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