Opened 5 years ago

Closed 5 years ago

#1389 closed change (fixed)

Discourse: Don't run queries for site settings if the correct value is already set

Reported by: trev Assignee: trev
Priority: P3 Milestone:
Module: Infrastructure Keywords:
Cc: Blocked By:
Blocking: Platform: Unknown
Ready: yes Confidential: no
Tester: Verified working: no
Review URL(s):

http://codereview.adblockplus.org/4533129582739456/

Description

Background

The discourse::sitesettings class is currently implemented in such a way that it will always run the PSQL query, no matter whether it would have any effect. We implemented it this way because we couldn't figure out how to use the unless class of the postgresql_psql type. This produces lots of unnecessary output, and it also triggers unnecessary Discourse restarts.

What to change

Turns out, unless doesn't care about the value returned. All it cares it the number of rows - an empty result means that the query is executed, a non-zero number of rows means "nothing to do."

Change History (2)

comment:1 Changed 5 years ago by trev

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:2 Changed 5 years ago by trev

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.