Skip to content

Commit

Permalink
GITC-448: fix bounty query and ensure jtbd runs every day once (#9538)
Browse files Browse the repository at this point in the history
* fix bounty query and ensure jtbd runs every day once

* Update grants_extra.py
  • Loading branch information
thelostone-mc authored Sep 29, 2021
1 parent 91a8284 commit 8eb83dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions app/grants/templatetags/grants_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ def modulo(num, val):
int: The modulo of number and value.
"""

return num % val
if num and val:
return num % val
return 0

@register.simple_tag
def is_team_member(grant, profile):
Expand Down
3 changes: 2 additions & 1 deletion app/perftools/management/commands/create_jtbd_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ def create_jtbd_earn_cache():
thirty_days_ago = timezone.now() - datetime.timedelta(days=30)

bounties = list(Bounty.objects.filter(
network='mainnet', event=None, idx_status='open', created_on__gt=thirty_days_ago
network='mainnet', event=None, idx_status='open', created_on__gt=thirty_days_ago,
current_bounty=True
).order_by('-_val_usd_db').extra(
select={'val_usd_db': '_val_usd_db'}
).values(
Expand Down
5 changes: 4 additions & 1 deletion scripts/crontab
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/us
30 * * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash create_gas_history >> /var/log/gitcoin/create_gas_history.log 2>&1
0 19 * * 7 cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash vacuum >> /var/log/gitcoin/vacuum.log 2>&1
2 */3 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash create_page_cache >> /var/log/gitcoin/create_page_cache.log 2>&1
30 */3 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash create_jtbd_cache >> /var/log/gitcoin/create_jtbd_cache.log 2>&1

# every day at 6PM
0 18 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash create_jtbd_cache >> /var/log/gitcoin/create_jtbd_cache.log 2>&1

1 */30 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash create_activity_cache >> /var/log/gitcoin/create_activity_cache.log 2>&1


Expand Down

0 comments on commit 8eb83dd

Please sign in to comment.