Skip to content

Commit b91d63b

Browse files
authored
Merge pull request #195 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 71d4297 + 2d1f061 commit b91d63b

File tree

8 files changed

+63
-127
lines changed

8 files changed

+63
-127
lines changed

.github/workflows/dev_cipp27qz5.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/dev_cipppwrro.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/dev_cippyumsh-proc.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/workflows/dev_cippyumsh.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

Modules/CIPPCore/Public/Clear-CippDurables.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ function Clear-CippDurables {
4444
}
4545

4646
$CippQueueTasks = Get-CippTable -TableName 'CippQueueTasks'
47-
$RunningTasks = Get-CIPPAzDataTableEntity @CippQueueTasks -Filter "Status eq 'Running'" -Property RowKey, PartitionKey, Status
47+
$RunningTasks = Get-CIPPAzDataTableEntity @CippQueueTasks -Filter "PartitionKey eq 'Task' and Status eq 'Running'" -Property RowKey, PartitionKey, Status
4848
if (($RunningTasks | Measure-Object).Count -gt 0) {
4949
if ($PSCmdlet.ShouldProcess('Tasks', 'Mark Failed')) {
5050
$UpdatedTasks = foreach ($Task in $RunningTasks) {

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecDurableFunctions.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ function Invoke-ExecDurableFunctions {
116116
}
117117

118118
$CippQueueTasks = Get-CippTable -TableName 'CippQueueTasks'
119-
$RunningTasks = Get-CIPPAzDataTableEntity @CippQueueTasks -Filter "Status eq 'Running'" -Property RowKey, PartitionKey, Status
119+
$RunningTasks = Get-CIPPAzDataTableEntity @CippQueueTasks -Filter "PartitionKey eq 'Task' and Status eq 'Running'" -Property RowKey, PartitionKey, Status
120120
if (($RunningTasks | Measure-Object).Count -gt 0) {
121121
if ($PSCmdlet.ShouldProcess('Tasks', 'Mark Failed')) {
122122
$UpdatedTasks = foreach ($Task in $RunningTasks) {
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
function Invoke-PublicPing {
2+
<#
3+
.FUNCTIONALITY
4+
Entrypoint
5+
.ROLE
6+
Public
7+
#>
8+
[CmdletBinding()]
9+
Param(
10+
$Request,
11+
$TriggerMetadata
12+
)
13+
14+
$KeepaliveTable = Get-CippTable -tablename 'CippKeepAlive'
15+
$LastKeepalive = Get-CippAzDataTableEntity @KeepaliveTable -Filter "PartitionKey eq 'Ping' and RowKey eq 'Ping'"
16+
17+
if ($LastKeepalive.Timestamp) {
18+
$LastKeepalive = $LastKeepalive.Timestamp.DateTime.ToUniversalTime()
19+
} else {
20+
$LastKeepalive = (Get-Date).AddSeconds(-600).ToUniversalTime()
21+
}
22+
$KeepaliveInterval = -300
23+
$NextKeepAlive = (Get-Date).AddSeconds($KeepaliveInterval).ToUniversalTime()
24+
25+
$IsColdStart = $Request.Headers.'x-ms-coldstart' -eq 1
26+
27+
if ($LastKeepalive -le $NextKeepAlive -or $IsColdStart) {
28+
$Keepalive = @{
29+
PartitionKey = 'Ping'
30+
RowKey = 'Ping'
31+
}
32+
Add-AzDataTableEntity @KeepaliveTable -Entity $Keepalive -Force
33+
34+
if ($IsColdStart) {
35+
$Milliseconds = 500
36+
} else {
37+
$Milliseconds = 150
38+
}
39+
40+
Start-Sleep -Milliseconds $Milliseconds
41+
}
42+
43+
$Body = @{
44+
Results = @{
45+
Message = 'Pong'
46+
ColdStart = $IsColdStart
47+
Timestamp = (Get-Date).ToUniversalTime()
48+
RequestId = $TriggerMetadata.InvocationId
49+
}
50+
}
51+
52+
Push-OutputBinding -Name Response -Value ([HttpResponseContext]@{
53+
StatusCode = [HttpStatusCode]::OK
54+
Body = ($Body | ConvertTo-Json -Depth 5)
55+
})
56+
}

Modules/CIPPCore/Public/Entrypoints/Timer Functions/Start-TableCleanup.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,31 @@ function Start-TableCleanup {
1717
@{
1818
DataTableProps = @{
1919
Context = (Get-CIPPTable -tablename 'AuditLogSearches').Context
20-
Filter = "Timestamp lt datetime'$((Get-Date).AddDays(-1).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
20+
Filter = "PartitionKey eq 'Search' and Timestamp lt datetime'$((Get-Date).AddDays(-1).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
2121
First = 10000
2222
Property = @('PartitionKey', 'RowKey', 'ETag')
2323
}
2424
}
2525
@{
2626
DataTableProps = @{
2727
Context = (Get-CIPPTable -tablename 'CippFunctionStats').Context
28-
Filter = "Timestamp lt datetime'$((Get-Date).AddDays(-7).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
28+
Filter = "PartitionKey eq 'Durable' and Timestamp lt datetime'$((Get-Date).AddDays(-7).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
2929
First = 10000
3030
Property = @('PartitionKey', 'RowKey', 'ETag')
3131
}
3232
}
3333
@{
3434
DataTableProps = @{
3535
Context = (Get-CIPPTable -tablename 'CippQueue').Context
36-
Filter = "Timestamp lt datetime'$((Get-Date).AddDays(-7).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
36+
Filter = "PartitionKey eq 'CippQueue' and Timestamp lt datetime'$((Get-Date).AddDays(-7).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
3737
First = 10000
3838
Property = @('PartitionKey', 'RowKey', 'ETag')
3939
}
4040
}
4141
@{
4242
DataTableProps = @{
4343
Context = (Get-CIPPTable -tablename 'CippQueueTasks').Context
44-
Filter = "Timestamp lt datetime'$((Get-Date).AddDays(-7).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
44+
Filter = "PartitionKey eq 'Task' and Timestamp lt datetime'$((Get-Date).AddDays(-7).ToUniversalTime().ToString('yyyy-MM-ddTHH:mm:ssZ'))'"
4545
First = 10000
4646
Property = @('PartitionKey', 'RowKey', 'ETag')
4747
}
@@ -61,7 +61,7 @@ function Start-TableCleanup {
6161
try {
6262
Remove-AzDataTable -Context $Table.Context -Force
6363
} catch {
64-
Write-LogMessage -API 'TableCleanup' -message "Failed to delete table $($Table.Context.TableName)" -sev Error -LogData (Get-CippException -Exception $_)
64+
#Write-LogMessage -API 'TableCleanup' -message "Failed to delete table $($Table.Context.TableName)" -sev Error -LogData (Get-CippException -Exception $_)
6565
}
6666
}
6767
} catch {

0 commit comments

Comments
 (0)