Skip to content

Commit

Permalink
[finish-heartbeat] removes the enable heartbeat experiment, heartbeat…
Browse files Browse the repository at this point in the history
… (aka keepalive) is globally enabled.
  • Loading branch information
biblicabeebli committed May 31, 2024
1 parent 04b93cc commit b07057c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
17 changes: 17 additions & 0 deletions database/migrations/0122_remove_participant_enable_heartbeat.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.11 on 2024-05-29 14:18

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('database', '0121_alter_devicesettings_heartbeat_timer_minutes'),
]

operations = [
migrations.RemoveField(
model_name='participant',
name='enable_heartbeat',
),
]
2 changes: 0 additions & 2 deletions database/user_models_participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ class Participant(AbstractPasswordUser):
# backend feature, some are for app features. (features under active development should be
# annotated in some way but no promises.)
# Set help text over in /forms/django_forms.py
enable_heartbeat = models.BooleanField(default=False)
enable_aggressive_background_persistence = models.BooleanField(default=False)
enable_binary_uploads = models.BooleanField(default=False)
enable_new_authentication = models.BooleanField(default=False)
Expand All @@ -122,7 +121,6 @@ class Participant(AbstractPasswordUser):
enable_extensive_device_info_tracking = models.BooleanField(default=False)

EXPERIMENT_FIELDS = (
"enable_heartbeat",
# "enable_aggressive_background_persistence",
# "enable_binary_uploads",
# "enable_new_authentication",
Expand Down
2 changes: 1 addition & 1 deletion forms/django_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ class Meta:

class ParticipantExperimentForm(forms.ModelForm):
EXPERIMENT_DESCRIPTIONS = {
"enable_heartbeat": "The server will send a notification to the participant asking them to open the app if the device has not checked in for over an hour.",
# "enable_heartbeat": "The server will send a notification to the participant asking them to open the app if the device has not checked in for over an hour.",
"enable_extensive_device_info_tracking": "Store device info every time the device makes an API call to the server. (This can generate a lot of data, it is for development and debugging purposes only.)",
}

Expand Down
2 changes: 0 additions & 2 deletions services/celery_push_notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,6 @@ def heartbeat_query() -> List[Tuple[int, str, str, str]]:
query = ParticipantFCMHistory.objects.filter(
any_activity_field_gt_one_week_ago,

participant__enable_heartbeat=True, # TODO: remove this after feature completion.

participant__deleted=False, # no deleted participants
participant__permanently_retired=False, # should be rendundant with deleted.
unregistered=None, # this is fcm-speak for non-retired fcm token
Expand Down
9 changes: 4 additions & 5 deletions tests/test_celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class TestHeartbeatQuery(TestCelery):
def set_working_heartbeat_notification_basics(self):
# we are not testing fcm token details in these tests.
self.default_participant.update(
deleted=False, permanently_retired=False, enable_heartbeat=True,
deleted=False, permanently_retired=False
)
self.populate_default_fcm_token

Expand All @@ -149,7 +149,7 @@ def set_working_heartbeat_notification_fully_valid(self):
# after calling this function the default participant should be found by the heartbeat query
now = timezone.now()
self.default_participant.update(
deleted=False, permanently_retired=False, enable_heartbeat=True, last_upload=now - timedelta(minutes=61),
deleted=False, permanently_retired=False, last_upload=now - timedelta(minutes=61),
)
self.populate_default_fcm_token

Expand Down Expand Up @@ -338,7 +338,7 @@ def test_query_multiple_participants_with_both_valid(self):
p2 = self.generate_participant(self.default_study)
self.generate_fcm_token(p2, None)
p2.update(
deleted=False, permanently_retired=False, enable_heartbeat=True, last_upload=timezone.now() - timedelta(minutes=61),
deleted=False, permanently_retired=False, last_upload=timezone.now() - timedelta(minutes=61),
)
self.assertEqual(Participant.objects.all().count(), 2)
self.assertEqual(len(heartbeat_query()), 2)
Expand Down Expand Up @@ -387,7 +387,7 @@ def test_heartbeat_notification_two_participants(
p2 = self.generate_participant(self.default_study)
self.generate_fcm_token(p2, None)
p2.update(
deleted=False, permanently_retired=False, enable_heartbeat=True, last_upload=timezone.now() - timedelta(minutes=61),
deleted=False, permanently_retired=False, last_upload=timezone.now() - timedelta(minutes=61),
)

create_heartbeat_tasks()
Expand All @@ -411,7 +411,6 @@ def test_heartbeat_notification_two_participants_one_failure(
p2.update(
deleted=False,
permanently_retired=False,
enable_heartbeat=True,
last_upload=timezone.now() - timedelta(minutes=61),
)

Expand Down
1 change: 0 additions & 1 deletion tests/test_mobile_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,6 @@ def test_success(self):
'consent_sections': DEFAULT_CONSENT_SECTIONS,

# Experiment features, yep you gotta manually change it when you change them too.
'enable_heartbeat': False,
# 'enable_binary_uploads': False,
# 'enable_new_authentication': False,
# 'enable_developer_datastream': False,
Expand Down

0 comments on commit b07057c

Please sign in to comment.