mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Easing UPDATE when recounting. Also updating hugepages in postgres.
This commit is contained in:
parent
0c7d6a1a6a
commit
dc21564e39
5 changed files with 17 additions and 4 deletions
|
@ -682,6 +682,8 @@ class UserSubscription(models.Model):
|
|||
ong = self.unread_count_negative
|
||||
ont = self.unread_count_neutral
|
||||
ops = self.unread_count_positive
|
||||
oousd = self.oldest_unread_story_date
|
||||
onur = self.needs_unread_recalc
|
||||
|
||||
# if not self.feed.fetched_once:
|
||||
# if not silent:
|
||||
|
@ -783,8 +785,15 @@ class UserSubscription(models.Model):
|
|||
self.oldest_unread_story_date = oldest_unread_story_date
|
||||
self.needs_unread_recalc = False
|
||||
|
||||
self.save()
|
||||
|
||||
update_fields = []
|
||||
if self.unread_count_positive != ops: update_fields.append('unread_count_positive')
|
||||
if self.unread_count_neutral != ont: update_fields.append('unread_count_neutral')
|
||||
if self.unread_count_negative != ong: update_fields.append('unread_count_negative')
|
||||
if self.oldest_unread_story_date != oousd: update_fields.append('oldest_unread_story_date')
|
||||
if self.needs_unread_recalc != onur: update_fields.append('needs_unread_recalc')
|
||||
if len(update_fields):
|
||||
self.save(update_fields=update_fields)
|
||||
|
||||
if (self.unread_count_positive == 0 and
|
||||
self.unread_count_neutral == 0):
|
||||
self.mark_feed_read()
|
||||
|
|
|
@ -399,6 +399,7 @@ class SearchFeed:
|
|||
q.add_should(pyes.query.MatchQuery('address', text, analyzer="simple", cutoff_frequency=0.0005, minimum_should_match="75%"))
|
||||
q.add_should(pyes.query.MatchQuery('link', text, analyzer="simple", cutoff_frequency=0.0005, minimum_should_match="75%"))
|
||||
q.add_should(pyes.query.MatchQuery('title', text, analyzer="simple", cutoff_frequency=0.0005, minimum_should_match="75%"))
|
||||
q = pyes.Search(q, min_score=1)
|
||||
results = cls.ES().search(query=q, size=5, doc_types=[cls.type_name()], sort="num_subscribers:desc")
|
||||
|
||||
return results
|
||||
|
|
|
@ -125,6 +125,8 @@ maintenance_work_mem = 512MB # min 1MB
|
|||
# (change requires restart)
|
||||
#shared_preload_libraries = '' # (change requires restart)
|
||||
|
||||
huge_pages = on
|
||||
|
||||
# - Cost-Based Vacuum Delay -
|
||||
|
||||
#vacuum_cost_delay = 0ms # 0-100 milliseconds
|
||||
|
|
3
fabfile.py
vendored
3
fabfile.py
vendored
|
@ -853,7 +853,7 @@ def setup_rabbitmq():
|
|||
# sudo('apt-get -y install memcached')
|
||||
|
||||
def setup_postgres(standby=False):
|
||||
shmmax = 2300047872
|
||||
shmmax = 17672445952
|
||||
sudo('su root -c "echo \"deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main\" > /etc/apt/sources.list.d/pgdg.list"') # You might have to run this manually
|
||||
sudo('wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -')
|
||||
sudo('apt-get update')
|
||||
|
@ -863,6 +863,7 @@ def setup_postgres(standby=False):
|
|||
), '/etc/postgresql/9.4/main/postgresql.conf', use_sudo=True)
|
||||
sudo('echo "%s" > /proc/sys/kernel/shmmax' % shmmax)
|
||||
sudo('echo "\nkernel.shmmax = %s" > /etc/sysctl.conf' % shmmax)
|
||||
sudo('echo "\nvm.nr_hugepages = 9000\n" > /etc/sysctl.conf' % shmmax)
|
||||
sudo('sysctl -p')
|
||||
|
||||
if standby:
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
<img src="/media/img/logo_512.png" class="logo">
|
||||
<h1>NewsBlur is in <span class="error404">maintenance mode</span></h1>
|
||||
<div class="description">
|
||||
<p>Tuning PostgreSQL requires a restart of the database. This should take no more than 2 minutes.</p>
|
||||
<p>Tuning PostgreSQL requires a restart of the database. This should take no more than 2 minutes. This is another attempt to fix the intermittent 502/downtime that we've been having for the past week.</p>
|
||||
<p>To pass the time, <a href="http://mlkshk.com/popular">check out what's popular on MLKSHK</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue