-
Notifications
You must be signed in to change notification settings - Fork 50
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
Message being lost with -Wait-Logging flag #64
Comments
I need to take a look into this issue cause my module uses runspace to spawn a thread that actually write the log. Maybe a runspace inside another runspace is not a good idea for the sanity of the environment in which it runs. I'll take a look to see if I can work around something |
Hi, I am having a real hard time to understand the mechanic behind the module as I am not familiar with anything related to “runspace”. I notice that Wait-Logging is waiting for “LoggingEventQueue.Count -gt 0”. However, is the count goes to Zero as soon as “.GetConsumingEnumerable()” is executed? As a workaround, I move the sleep in Wait-Logging to be after the Count check. And that does help. However, I need at least 200ms to be somewhat reliable. |
@SilentBob999 Are you using the logging module with PoshRSJob? |
Hi @EsOsO , |
GetConsumingEnumerableThe count does not drop to zero just by calling 'GetConsumingEnumerable()'.
Wait-LoggingThe last part is about messages being lost, the only portion that should (now) be able to be lost is the last message with Wait-Logging. This could be "fixable" by simply adding another Wait-Sleep after the loop. (I used my current feature implementation, however this should not alter from the current master.)
|
@EsOsO I think this issue can now be closed. |
I have a script that does tasks in different threads and I noticed that some messages were being lost. I used the following script to test:
The script above spawns 5 concurrent threads, each one logging 100 message to the log file.
Expected result: 500 lines written to example CSV file
Actual result: Number of lines written varies. May need to try different times.
Note: I'm using PoshRSJob for multithreading.
The text was updated successfully, but these errors were encountered: