0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00

🐛 Fixed degraded database performance when using the Post Analytics screen (#22031)

ref
https://linear.app/ghost/issue/ONC-717/support-escalation-re-dashboard-unresponsive

This reverts commit 9082a9f1db, which
introduced an automatic refresh interval on the Post Analytics screen in
Admin. This change led to an increase in the number of requests to the
`/ghost/api/admin/members/events/` endpoint, which is a particularly
database intensive endpoint. Ultimately this led to significantly higher
load on the database which degraded performance for sites with a large
`email_recipients` table.
This commit is contained in:
Chris Raible 2025-01-20 17:34:04 -08:00
parent ff4545939c
commit 2ecf7ff5c9
2 changed files with 9 additions and 12 deletions

View file

@ -35,6 +35,14 @@
{{/let}} {{/let}}
</div> </div>
<div style="display: flex; gap: 8px;"> <div style="display: flex; gap: 8px;">
<GhTaskButton
@buttonText="Refresh"
@task={{this.fetchPostTask}}
@showIcon={{true}}
@idleIcon="reload"
@successText="Refreshed"
@class="gh-btn gh-btn-icon refresh"
@successClass="gh-btn gh-btn-icon refresh" />
{{#unless this.post.emailOnly}} {{#unless this.post.emailOnly}}
<button type="button" class="gh-btn gh-btn-icon share" {{on "click" this.togglePublishFlowModal}}> <button type="button" class="gh-btn gh-btn-icon share" {{on "click" this.togglePublishFlowModal}}>
<span>{{svg-jar "share" title="Share post"}} Share</span> <span>{{svg-jar "share" title="Share post"}} Share</span>

View file

@ -3,7 +3,7 @@ import DeletePostModal from '../modals/delete-post';
import PostSuccessModal from '../modal-post-success'; import PostSuccessModal from '../modal-post-success';
import anime from 'animejs/lib/anime.es.js'; import anime from 'animejs/lib/anime.es.js';
import {action} from '@ember/object'; import {action} from '@ember/object';
import {didCancel, task, timeout} from 'ember-concurrency'; import {didCancel, task} from 'ember-concurrency';
import {inject as service} from '@ember/service'; import {inject as service} from '@ember/service';
import {tracked} from '@glimmer/tracking'; import {tracked} from '@glimmer/tracking';
@ -19,8 +19,6 @@ const DISPLAY_OPTIONS = [{
value: 'paid' value: 'paid'
}]; }];
const AUTO_REFRESH_RATE = 7500;
export default class Analytics extends Component { export default class Analytics extends Component {
@service ajax; @service ajax;
@service ghostPaths; @service ghostPaths;
@ -53,8 +51,6 @@ export default class Analytics extends Component {
constructor() { constructor() {
super(...arguments); super(...arguments);
this.checkPublishFlowModal(); this.checkPublishFlowModal();
this.fetchPostTask.perform();
this.autoRefreshTask.perform();
} }
openPublishFlowModal() { openPublishFlowModal() {
@ -394,13 +390,6 @@ export default class Analytics extends Component {
return true; return true;
} }
@task
*autoRefreshTask() {
yield timeout(AUTO_REFRESH_RATE);
yield this.fetchPostTask.perform();
this.autoRefreshTask.perform();
}
@action @action
applyClasses(element) { applyClasses(element) {
if (!this.shouldAnimate || if (!this.shouldAnimate ||