Skip to content

Commit 05bd377

Browse files
bmehta001Copilot
andcommitted
Address runtime review comments
Fix printf-style logging arguments for scheduled upload delays and queued worker task pointers. Ensure the blocking cancel test releases the dispatcher before failing so async futures cannot hang the test runner. Files changed: - lib/pal/WorkerThread.cpp - lib/tpm/TransmissionPolicyManager.cpp - tests/unittests/TransmissionPolicyManagerTests.cpp Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 5638972 commit 05bd377

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

lib/pal/WorkerThread.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ namespace PAL_NS_BEGIN {
109109

110110
void Queue(MAT::Task* item) final
111111
{
112-
LOG_INFO("queue item=%p", &item);
112+
LOG_INFO("queue item=%p", static_cast<void*>(item));
113113
LOCKGUARD(m_lock);
114114
if (m_shuttingDown) {
115-
LOG_WARN("Dropping queued task %p during shutdown", item);
115+
LOG_WARN("Dropping queued task %p during shutdown", static_cast<void*>(item));
116116
delete item;
117117
return;
118118
}
@@ -298,4 +298,3 @@ namespace PAL_NS_BEGIN {
298298
} PAL_NS_END
299299

300300
#endif
301-

lib/tpm/TransmissionPolicyManager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ namespace MAT_NS_BEGIN {
115115
{
116116
if (delay.count() < 0 || m_timerdelay.count() < 0)
117117
{
118-
LOG_TRACE("Negative delay(%d) or m_timerdelay(%d), no upload", delay.count(), m_timerdelay.count());
118+
LOG_TRACE("Negative delay(%lld) or m_timerdelay(%lld), no upload",
119+
static_cast<long long>(delay.count()),
120+
static_cast<long long>(m_timerdelay.count()));
119121
return true;
120122
}
121123
if (m_scheduledUploadAborted)

tests/unittests/TransmissionPolicyManagerTests.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,12 @@ TEST_F(TransmissionPolicyManagerTests, ForceScheduleRetainsImmediateUploadWhenCa
766766
blockingTpm.scheduleUploadParent(std::chrono::milliseconds{}, EventLatency_RealTime, true);
767767
});
768768

769-
ASSERT_TRUE(dispatcher.WaitForCancel(std::chrono::milliseconds{ 250 }));
769+
if (!dispatcher.WaitForCancel(std::chrono::milliseconds{ 250 }))
770+
{
771+
dispatcher.ReleaseCancel();
772+
forceSchedule.get();
773+
FAIL() << "Timed out waiting for cancel to block";
774+
}
770775

771776
auto delayedSchedule = std::async(std::launch::async, [&blockingTpm]() {
772777
blockingTpm.scheduleUploadParent(std::chrono::milliseconds{ 1000 }, EventLatency_Normal, false);

0 commit comments

Comments
 (0)