Skip to content

Commit 3786149

Browse files
committed
optimize queries
1 parent 6b81c0a commit 3786149

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Modules/CIPPCore/Public/Get-CIPPGeoIPLocation.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function Get-CIPPGeoIPLocation {
66

77
$CacheGeoIPTable = Get-CippTable -tablename 'cachegeoip'
88
$30DaysAgo = (Get-Date).AddDays(-30).ToString('yyyy-MM-ddTHH:mm:ssZ')
9-
$Filter = "RowKey eq '$IP' and Timestamp ge datetime'$30DaysAgo'"
9+
$Filter = "PartitionKey eq 'IP' and RowKey eq '$IP' and Timestamp ge datetime'$30DaysAgo'"
1010
$GeoIP = Get-CippAzDataTableEntity @CacheGeoIPTable -Filter $Filter
1111
if ($GeoIP) {
1212
return ($GeoIP.Data | ConvertFrom-Json)

Modules/CIPPCore/Public/Webhooks/Test-CIPPAuditLogRules.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ function Test-CIPPAuditLogRules {
110110
}
111111
if (!$Trusted) {
112112
$CacheLookupStartTime = Get-Date
113-
$Location = Get-AzDataTableEntity @LocationTable -Filter "RowKey eq '$($Data.clientIp)'" | Select-Object -ExcludeProperty Tenant
113+
$Location = Get-AzDataTableEntity @LocationTable -Filter "PartitionKey eq 'ip' and RowKey eq '$($Data.clientIp)'" | Select-Object -ExcludeProperty Tenant
114114
$CacheLookupEndTime = Get-Date
115115
$CacheLookupSeconds = ($CacheLookupEndTime - $CacheLookupStartTime).TotalSeconds
116116
Write-Warning "Cache lookup for IP $($Data.clientip) took $CacheLookupSeconds seconds"

0 commit comments

Comments
 (0)