Skip to content

Commit

Permalink
Set last_publish as a start of publish [RHELDST-5086, #8778]
Browse files Browse the repository at this point in the history
When a repository is published, set last_publish field on distributor
to the start time of publish instead of finish time. This fix relates
to erraum content type which can be updated even if a repo is in
publish.

With this change pulp shouldn't falsely skip publish of a repo when
last_unit_added is set to time between publish start and finish.

Closes #8778
https://pulp.plan.io/issues/8778
  • Loading branch information
rbikar authored and ipanova committed May 19, 2021
1 parent 553348c commit dde5633
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/pulp/server/controllers/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,7 @@ def check_publish(repo_obj, dist_id, dist_inst, transfer_repo, conduit, call_con
# Use raw pymongo not to fire the signal hander
model.Distributor.objects(
repo_id=repo_obj.repo_id,
distributor_id=dist_id).update(set__last_publish=publish_end_timestamp)
distributor_id=dist_id).update(set__last_publish=publish_start_timestamp)

result_code = RepoPublishResult.RESULT_SKIPPED
_logger.debug('publish skipped for repo [%s] with distributor ID [%s]' % (
Expand Down Expand Up @@ -1341,7 +1341,7 @@ def _do_publish(repo_obj, dist_id, dist_inst, transfer_repo, conduit, call_confi
if not publish_report.canceled_flag:
# Use raw pymongo not to fire the signal hander
model.Distributor.objects(repo_id=repo_obj.repo_id, distributor_id=dist_id).\
update(set__last_publish=publish_end_timestamp)
update(set__last_publish=publish_start_timestamp)

# Add a publish entry
summary = publish_report.summary
Expand Down

0 comments on commit dde5633

Please sign in to comment.