File tree 3 files changed +22
-2
lines changed
3 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -828,6 +828,16 @@ def remove_orphan_symlinks():
828
828
os .unlink (orphan_domain_path )
829
829
830
830
831
+ @app .task (queue = 'web' )
832
+ def broadcast_remove_orphan_symlinks ():
833
+ """
834
+ Broadcast the task ``remove_orphan_symlinks`` to all our web servers.
835
+
836
+ This task is executed by CELERY BEAT.
837
+ """
838
+ broadcast (type = 'web' , task = remove_orphan_symlinks , args = [])
839
+
840
+
831
841
@app .task (queue = 'web' )
832
842
def symlink_subproject (project_pk ):
833
843
project = Project .objects .get (pk = project_pk )
Original file line number Diff line number Diff line change 14
14
15
15
from readthedocs .builds .models import Version
16
16
from readthedocs .projects .models import Project , Domain
17
- from readthedocs .projects .tasks import symlink_project , remove_orphan_symlinks
17
+ from readthedocs .projects .tasks import broadcast_remove_orphan_symlinks , remove_orphan_symlinks , symlink_project
18
18
from readthedocs .core .symlink import PublicSymlink , PrivateSymlink
19
19
20
20
@@ -238,6 +238,16 @@ def test_symlink_remove_orphan_symlinks(self):
238
238
239
239
self .assertFilesystem (filesystem )
240
240
241
+ def test_broadcast_remove_orphan_symlinks (self ):
242
+ """Broadcast orphan symlinks is called with the proper attributes."""
243
+ with mock .patch ('readthedocs.projects.tasks.broadcast' ) as broadcast :
244
+ broadcast_remove_orphan_symlinks ()
245
+
246
+ broadcast .assert_called_with (
247
+ type = 'web' ,
248
+ task = remove_orphan_symlinks ,
249
+ args = [],
250
+ )
241
251
242
252
def test_symlink_cname_dont_link_missing_domains (self ):
243
253
"""Domains should be relinked after deletion"""
Original file line number Diff line number Diff line change @@ -247,7 +247,7 @@ def USE_PROMOS(self): # noqa
247
247
CELERYBEAT_SCHEDULE = {
248
248
# Ran every hour on minute 30
249
249
'hourly-remove-orphan-symlinks' : {
250
- 'task' : 'readthedocs.projects.tasks.remove_orphan_symlinks ' ,
250
+ 'task' : 'readthedocs.projects.tasks.broadcast_remove_orphan_symlinks ' ,
251
251
'schedule' : crontab (minute = 30 ),
252
252
'options' : {'queue' : 'web' },
253
253
},
You can’t perform that action at this time.
0 commit comments