Skip to content
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

Backport #12783: macOS: disable AppNap during sync (and mixing) #3024

Merged
merged 3 commits into from
Jul 15, 2019

Conversation

UdjinM6
Copy link

@UdjinM6 UdjinM6 commented Jul 11, 2019

bitcoin#12783 1e0f3c4 macOS: disable AppNap during sync (Alexey Ivanov)

Original pull request description:

  Code based on pull/5804. Tested only on macOS 10.13.3 and should support 10.9+.

  What macOS versions bitcoin core currently supports?

Tree-SHA512: 85809b8d8d8a05169437b4268988da0b7372c29c6da3223ebdc106dc16dcb6d3caa5c52ace3591467005b50a63fd8b2ab1cb071cb4f450032932df25d5063315

The same issue is affecting mixing (which is quite annoying), so I modified it accordingly. Tested on 10.14.5 and it seems to be working as expected. Images below are for this patch (2192), official 0.14.0.2 app (2201) and current develop (2203), all started in regtest mode at ~ the same time.

After a minute or so, not synced:

Screenshot 2019-07-11 at 08 27 23

Forced sync (mnsync next), generated 1 block, waited ~1 minute:

Screenshot 2019-07-11 at 08 46 27

Started mixing, generated 1 more block, waited ~1 minute:

Screenshot 2019-07-11 at 08 52 42

1e0f3c4 macOS: disable AppNap during sync (Alexey Ivanov)

Pull request description:

  Code based on pull/5804. Tested only on macOS 10.13.3 and should support 10.9+.

  What macOS versions bitcoin core currently supports?

Tree-SHA512: 85809b8d8d8a05169437b4268988da0b7372c29c6da3223ebdc106dc16dcb6d3caa5c52ace3591467005b50a63fd8b2ab1cb071cb4f450032932df25d5063315
@UdjinM6 UdjinM6 added this to the 14.1 milestone Jul 11, 2019
Copy link

@codablock codablock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See inline comment 🙈

@@ -950,6 +956,15 @@ void BitcoinGUI::updateHeadersSyncProgressLabel()

void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVerificationProgress, bool header)
{
#ifdef Q_OS_MAC
Copy link

@codablock codablock Jul 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh my... :D
The original from Bitcoin was already bad...using the ternary operator as a replacement for if/else and at the same time relying on the side effects of the evaluation result... :D
Can you maybe change this to something as simple as:

#ifdef Q_OS_MAC
    bool disableAppNap = !masternodeSync.IsSynced();
#ifdef ENABLE_WALLET
    if (privateSendClient.fPrivateSendRunning) {
        disableAppNap = true;
    }
#endif
    if (disableAppNap) {
        m_app_nap_inhibitor->disableAppNap()
    } else {
        m_app_nap_inhibitor->enableAppNap()
    }
#edif

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the code sample to use disableAppNap instead of enableAppNap

Copy link
Author

@UdjinM6 UdjinM6 Jul 11, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about 7ffb163? :) (mostly the same as yours, just changed if (privateSendClient.fPrivateSendRunning) part)

codablock
codablock previously approved these changes Jul 11, 2019
Copy link

@codablock codablock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@UdjinM6
Copy link
Author

UdjinM6 commented Jul 11, 2019

Force-pushed to trigger Travis build (failure seems to be unrelated https://travis-ci.org/dashpay/dash/jobs/557206151#L2645 but just in case).

codablock
codablock previously approved these changes Jul 11, 2019
Copy link

@codablock codablock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-utACK

Copy link
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

Copy link

@codablock codablock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-utACK

@UdjinM6 UdjinM6 merged commit d57cbc6 into dashpay:develop Jul 15, 2019
codablock pushed a commit to codablock/dash that referenced this pull request Aug 7, 2019
dashpay#3024)

* Merge bitcoin#12783: macOS: disable AppNap during sync

1e0f3c4 macOS: disable AppNap during sync (Alexey Ivanov)

Pull request description:

  Code based on pull/5804. Tested only on macOS 10.13.3 and should support 10.9+.

  What macOS versions bitcoin core currently supports?

Tree-SHA512: 85809b8d8d8a05169437b4268988da0b7372c29c6da3223ebdc106dc16dcb6d3caa5c52ace3591467005b50a63fd8b2ab1cb071cb4f450032932df25d5063315

* Refactor

* Drop `#include <memory>` from `src/qt/bitcoingui.h`

Was included by mistake.
codablock pushed a commit to codablock/dash that referenced this pull request Aug 7, 2019
dashpay#3024)

* Merge bitcoin#12783: macOS: disable AppNap during sync

1e0f3c4 macOS: disable AppNap during sync (Alexey Ivanov)

Pull request description:

  Code based on pull/5804. Tested only on macOS 10.13.3 and should support 10.9+.

  What macOS versions bitcoin core currently supports?

Tree-SHA512: 85809b8d8d8a05169437b4268988da0b7372c29c6da3223ebdc106dc16dcb6d3caa5c52ace3591467005b50a63fd8b2ab1cb071cb4f450032932df25d5063315

* Refactor

* Drop `#include <memory>` from `src/qt/bitcoingui.h`

Was included by mistake.
MIPPL pushed a commit to biblepay/biblepay that referenced this pull request Nov 20, 2019
* commit '7d8eab2641023c78a72ccd6efc99fc35fd030a46': (32 commits)
  Add 0.14.0.3 change log to release-notes.md (dashpay#3055)
  Update release-notes.md for 0.14.0.3 (dashpay#3054)
  Bump version to 0.14.0.3 and copy release notes (dashpay#3053)
  Re-verify invalid IS sigs when the active quorum set rotated (dashpay#3052)
  Remove recovered sigs from the LLMQ db when corresponding IS locks get confirmed (dashpay#3048)
  Add "instantsendlocks" to getmempoolinfo RPC (dashpay#3047)
  Use fEnablePrivateSend instead of fPrivateSendRunning
  Show number of InstantSend locks in Debug Console (dashpay#2919)
  Optimize on-disk deterministic masternode storage to reduce size of evodb (dashpay#3017)
  Add "isValidMember" and "memberIndex" to "quorum memberof" and allow to specify quorum scan count (dashpay#3009)
  Implement "quorum memberof" (dashpay#3004)
  Bail out properly on Evo DB consistency check failures in ConnectBlock/DisconnectBlock (dashpay#3044)
  Do not count 0-fee txes for fee estimation (dashpay#3037)
  Fix broken link in PrivateSend info dialog (dashpay#3031)
  Merge pull request dashpay#3028 from PastaPastaPasta/backport-12588
  Add Dash Core Group codesign certificate (dashpay#3027)
  Fix osslsigncode compile issue in gitian-build (dashpay#3026)
  Backport bitcoin#12783: macOS: disable AppNap during sync (and mixing) (dashpay#3024)
  Remove support for InstantSend locked gobject collaterals (dashpay#3019)
  [v0.14.0.x] Update release notes for 0.14.0.2 (dashpay#3012)
  ...

# Conflicts:
#	.gitignore
#	.travis.yml
#	configure.ac
#	doc/man/biblepay-cli.1
#	doc/man/biblepay-qt.1
#	doc/man/biblepay-tx.1
#	doc/man/biblepayd.1
#	doc/release-notes.md
#	src/clientversion.h
#	src/qt/utilitydialog.cpp
barrystyle pushed a commit to PACGlobalOfficial/PAC that referenced this pull request Jan 22, 2020
dashpay#3024)

* Merge bitcoin#12783: macOS: disable AppNap during sync

1e0f3c4 macOS: disable AppNap during sync (Alexey Ivanov)

Pull request description:

  Code based on pull/5804. Tested only on macOS 10.13.3 and should support 10.9+.

  What macOS versions bitcoin core currently supports?

Tree-SHA512: 85809b8d8d8a05169437b4268988da0b7372c29c6da3223ebdc106dc16dcb6d3caa5c52ace3591467005b50a63fd8b2ab1cb071cb4f450032932df25d5063315

* Refactor

* Drop `#include <memory>` from `src/qt/bitcoingui.h`

Was included by mistake.
@UdjinM6 UdjinM6 deleted the macosappnap12783 branch November 26, 2020 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants