Skip to content

Commit

Permalink
Merge pull request #6781 from readthedocs/remove-skip-sync
Browse files Browse the repository at this point in the history
Revert "Add feature flag to just completely skip sync and symlink operations (#6689)"
  • Loading branch information
ericholscher authored Mar 17, 2020
2 parents bbd844e + c4ff055 commit 754dd59
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 32 deletions.
34 changes: 15 additions & 19 deletions readthedocs/builds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,37 +319,33 @@ def save(self, *args, **kwargs): # pylint: disable=arguments-differ
"""Add permissions to the Version for all owners on save."""
from readthedocs.projects import tasks
obj = super().save(*args, **kwargs)
if not self.project.has_feature(feature_id='skip_sync'):
broadcast(
type='app',
task=tasks.symlink_project,
args=[self.project.pk],
)
broadcast(
type='app',
task=tasks.symlink_project,
args=[self.project.pk],
)
return obj

def delete(self, *args, **kwargs): # pylint: disable=arguments-differ
from readthedocs.projects import tasks
log.info('Removing files for version %s', self.slug)
has_skip_sync = self.project.has_feature(feature_id='skip_sync')
if not has_skip_sync:
broadcast(
type='app',
task=tasks.remove_dirs,
args=[self.get_artifact_paths()],
)
broadcast(
type='app',
task=tasks.remove_dirs,
args=[self.get_artifact_paths()],
)

# Remove resources if the version is not external
if self.type != EXTERNAL:
tasks.clean_project_resources(self.project, self)

project_pk = self.project.pk
super().delete(*args, **kwargs)
if not has_skip_sync:
broadcast(
type='app',
task=tasks.symlink_project,
args=[project_pk],
)
broadcast(
type='app',
task=tasks.symlink_project,
args=[project_pk],
)

@property
def identifier_friendly(self):
Expand Down
9 changes: 2 additions & 7 deletions readthedocs/projects/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,6 @@ def add_features(sender, **kwargs):
ALL_VERSIONS_IN_HTML_CONTEXT = 'all_versions_in_html_context'
SKIP_SYNC_TAGS = 'skip_sync_tags'
SKIP_SYNC_BRANCHES = 'skip_sync_branches'
SKIP_SYNC = 'skip_sync'
CACHED_ENVIRONMENT = 'cached_environment'

FEATURES = (
Expand Down Expand Up @@ -1574,17 +1573,13 @@ def add_features(sender, **kwargs):
'when building with Sphinx'
),
),
(
SKIP_SYNC_TAGS,
_('Skip syncing tags'),
),
(
SKIP_SYNC_BRANCHES,
_('Skip syncing branches'),
),
(
SKIP_SYNC,
_('Skip symlinking and file syncing to webs'),
SKIP_SYNC_TAGS,
_('Skip syncing tags'),
),
(
CACHED_ENVIRONMENT,
Expand Down
6 changes: 0 additions & 6 deletions readthedocs/projects/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,6 @@ def sync_files(
version = Version.objects.get_object_or_log(pk=version_pk)
if not version:
return
if version.project.has_feature(Feature.SKIP_SYNC):
return

# Sync files to the web servers
move_files(
Expand Down Expand Up @@ -1428,8 +1426,6 @@ def move_files(
@app.task(queue='web')
def symlink_project(project_pk):
project = Project.objects.get(pk=project_pk)
if project.has_feature(Feature.SKIP_SYNC):
return
for symlink in [PublicSymlink, PrivateSymlink]:
sym = symlink(project=project)
sym.run()
Expand All @@ -1446,8 +1442,6 @@ def symlink_domain(project_pk, domain, delete=False):
:type domain: str
"""
project = Project.objects.get(pk=project_pk)
if project.has_feature(Feature.SKIP_SYNC):
return
for symlink in [PublicSymlink, PrivateSymlink]:
sym = symlink(project=project)
if delete:
Expand Down

0 comments on commit 754dd59

Please sign in to comment.