On 9/4/19 2:30 PM, Gregory Pomerantz wrote:
currenly just running the go program from the terminal, though I got similar results packaging it into an app.

I soon get very long periods between ticker fires:

Tick slow: 3.501350114s
Tick slow: 5.551485377s

I am seeing the same thing (Late 2012 13" MacBook Pro Retina).

My first guess is that MacOS must be putting your App into a background low-power mode and scheduling it infrequently. My ticks go up to just about 11 seconds. because clicking on the App in the dock seems to (temporarily) fix this. I would check the AppKit docs for how to avoid background throttling, or see if the OS is sending you a message first that you can respond to and prevent it from happening. An alternative is to create a pure Go background task that interacts with a MacOS frontend through a socket, grpc or some other mechanism. Good luck and let me know if anything works.

Let me know if this works, it seems to fix the issue over here. Not sure what impact this has generally on power management, sleep mode etc. but you can read the AppKit docs for that.

void StartApp() {

    [NSAutoreleasePool new];
    [NSApplication sharedApplication];
    [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
    id activity = [[NSProcessInfo processInfo] beginActivityWithOptions:NSActivityBackground reason:@"Good Reason"];
    [NSApp run];
    [[NSProcessInfo processInfo] endActivity:activity];
}

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/d9ecc46a-d074-a283-94b1-4836866f6bf5%40wow.st.

Reply via email to