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

Added connection timeout. Fixes #7417 #7438

Merged
merged 3 commits into from
Jun 15, 2021
Merged

Conversation

sanderstad
Copy link
Contributor

Added splatting fof command for readability

Type of Change

  • Bug fix (non-breaking change, fixes [Bug] Invoke-DbaDbDataMasking - Parameter ConnectionTimeout (and others?) not used #7417 )
  • New feature (non-breaking change, adds functionality, fixes # )
  • Breaking change (effects multiple commands or functionality, fixes # )
  • Ran manual Pester test and has passed (.\tests\manual.pester.ps1)
  • Adding code coverage to existing functionality
  • Pester test is included
  • If new file reference added for test, has is been added to github.com/sqlcollaborative/appveyor-lab ?
  • Unit test is included
  • Documentation
  • Build system

Purpose

The invoke command the connection timeout to make sure that commands would not execute for a long period of time

Approach

Added variable to several query commands

Commands to test

Invoke-DbaDbDataMasking

Added splatting fof command for readability
@@ -367,7 +367,7 @@ function Invoke-DbaDbDataMasking {

$query = "CREATE NONCLUSTERED INDEX [$($maskingIndexName)] ON [$($dbTable.Schema)].[$($dbTable.Name)]([$($identityColumn)])"

Invoke-DbaQuery -SqlInstance $server -SqlCredential $SqlCredential -Database $db.Name -Query $query
Invoke-DbaQuery -SqlInstance $server -SqlCredential $SqlCredential -Database $db.Name -Query $query -QueryTimeout
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a $ConnectionTimeout missing at the end?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or better $CommandTimeout?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably the reason the tests fail.

@andreasjordan
Copy link
Contributor

andreasjordan commented Jun 15, 2021

Why do you use $ConnectionTimeout for -QueryTimeout of Invoke-DbaQuery? You also have $CommandTimeoutwhich you do not use at all and wich would be a better fit. And have a look at the documenation of the two parameters: They are the same.

Formatted list for better readability
Splatted command
Replaced connection timeout with command timeout
@sanderstad
Copy link
Contributor Author

@andreasjordan You are correct, there was an obsolete parameter.
I removed the connectiontimeout parameter and replaced everything with the command timeout.
I'm not sure why I put that in, maybe to distinquish the connection to the servers and the query timeouts separately

@sanderstad sanderstad self-assigned this Jun 15, 2021
@potatoqualitee
Copy link
Member

🙌🏼 awesome, thank you both!

@potatoqualitee potatoqualitee merged commit d04f06b into development Jun 15, 2021
@potatoqualitee potatoqualitee deleted the fix-maskingtimeout branch June 15, 2021 12:20
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.

[Bug] Invoke-DbaDbDataMasking - Parameter ConnectionTimeout (and others?) not used
3 participants