fix(lmxproxy): resolve write timeout — bypass OnWriteComplete callback for supervisory writes
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -44,8 +44,9 @@ Decisions made during implementation that differ from or extend the original pla
|
||||
**Why**: The `x-api-key` header always carries the caller's valid key (for interceptor auth). The `CheckApiKey` RPC is designed for clients to test whether a *different* key is valid, so it must check the body key independently.
|
||||
**How to apply**: `ScadaGrpcService` receives `ApiKeyService` as an optional constructor parameter.
|
||||
|
||||
## 7. Write integration tests pending
|
||||
## 7. Write completes synchronously (fire-and-forget)
|
||||
|
||||
**Status**: 2 of 17 integration tests fail (WriteAndReadBack, WriteBatchAndWait).
|
||||
**Why**: The `OnWriteComplete` COM callback from MxAccess doesn't fire within the timeout. This may be because MxAccess completes writes synchronously without invoking the callback, or the callback event subscription (`OperationCompleted` event) requires different wiring. The v1 code had the same pattern but may have relied on different MxAccess COM object initialization.
|
||||
**How to apply**: Investigate whether MxAccess `Write` returns synchronously (check HRESULT) and bypass the callback wait if so. Alternatively, check if `OperationCompleted` needs explicit COM event subscription via `IConnectionPoint`.
|
||||
**Plan specified**: Wait for `OnWriteComplete` COM callback to confirm write success.
|
||||
**Actual**: Write is confirmed synchronously — if `_lmxProxy.Write()` returns without throwing, the write succeeded. The `OnWriteComplete` callback is kept wired for diagnostic logging only.
|
||||
**Why**: MxAccess completes supervisory writes synchronously. The `OnWriteComplete` COM callback never fires for simple supervisory writes, causing the original implementation to timeout waiting for a callback that would never arrive. This caused WriteAndReadBack and WriteBatchAndWait integration tests to fail.
|
||||
**How to apply**: Do not await `OnWriteComplete` for write confirmation. The `Write()` COM call succeeding (not throwing a COM exception) is the confirmation. Clean up (UnAdvise + RemoveItem) happens immediately after the write in a finally block.
|
||||
|
||||
Reference in New Issue
Block a user