Having just updated to Commerce 2.37 and got the new dashboard (thank you), I have been struck by how slow cron calls have become. Our sites call cron as needed multiple times a minute to process queue items and other background tasks. That processing was backing up due to an additional 1-5 seconds on every cron call which couldn't be accounted for, except for one module update.

We found that InboxMessageFetcher::fetch() is called on every cron call, instead of every X hours. This fetch is slow due to DNS lookups (cached for 10s and 60s, with NS only cached for 5m) and a slow web server. Minimum turn-around is 1.8 seconds, but also up to 5s.

I would think that the inbox messages only need to be retrieved every day or week instead of tied directly to cron.

Also appears you need to add "Dashboard" as a component to report bugs on.

Why do you use Drupal\Core\Site\Settings instead of Drupal\Core\Config\Config? This would allow for adjusting of config through UI. I have not included this setting in a form because there seems to be no other config form for commerce core.

Issue fork commerce-3414195

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ELC created an issue. See original summary.

elc’s picture

Status: Active » Needs review

Test failures do not appear to be related to this issue. There do not appear to be any tests for the dashboard as yet.

Setting to NR for this issue, ignoring the failing tests.

jsacksick’s picture

Status: Needs review » Needs work

The test failures are definitely related :). Did you open the tests?

1) Drupal\Tests\commerce_cart\FunctionalJavascript\MultipleCartMultipleVariationTypesTest::testAddToCart
Drupal\Core\Config\Schema\SchemaIncompleteException: Schema errors for commerce_dashboard.settings with the following errors: commerce_dashboard.settings:_core missing schema, commerce_dashboard.settings:langcode missing schema

I suggest we keep it simple and just fetch once a day like you did without making this configurable. This was actually part of our initial internal requirements (and was overlooked I guess).

As for settings vs config, that's the route we've decided to take for now, as it's easy enough to just edit the settings.php as needed as long as it's documented.

jsacksick’s picture

Status: Needs work » Needs review

Ok, I got rid of the config object introduced. I think it's fine to just hardcode the run interval to once a day for now. I think the tests will be green again.

  • jsacksick committed 48ff160a on 8.x-2.x authored by ELC
    Issue #3414195 by ELC, jsacksick: Fetch inbox messages only once a day.
    

  • jsacksick committed 32a99a32 on 3.0.x authored by ELC
    Issue #3414195 by ELC, jsacksick: Fetch inbox messages only once a day.
    
jsacksick’s picture

Status: Needs review » Fixed

Went ahead and merged the MR. Thanks for reporting this.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.