对 SVNSYNC 的调用是否应该在提交后挂钩中阻塞?

发布于 2024-09-16 20:13:52 字数 591 浏览 9 评论 0原文

我已经设置了存储库的镜像,并且运行良好,但最近遇到了问题。

目标存储库以某种方式留下了未释放的锁 - 从我读到的内容来看,这可能是由 svnsync 操作中止引起的,我怀疑这可能是因为在我的提交后挂钩中,我正在阻塞模式下执行 svnsync 而不是推送通过 & 进入后台。

我这样做是为了让用户可以确定,如果提交完成,那么它现在就在所有存储库中,但也许这会带来他们点击取消并停止提交挂钩的风险?

我找不到关于哪个更好或最佳实践是什么的明确指南或建议,或者即使点击取消可能会导致提交后挂钩和从中执行的同步中止 - 在大多数地方我看到人们使用 & 。在后台启动同步 - 如果用户在同步正在进行时按“取消”按钮进行提交,这是否可以防止锁定损坏?如何确保两个存储库真正同步或报告问题?您是否需要一个单独的通知机制?

更新:

从上面的两个选项中,我决定选择第三个;)

我在后台调用 svnsync 但同时我让钩子等待它完成:

svnsync ... &
wait $!

我认为这很好地结合了两全其美的优点,但是时间将展示它的有效性 - 请让我知道您对整个问题的看法以及您可能需要分享的建议。

I've set up mirroring of my repository and it works nicely but I've had an issue recently.

The target repository was left with an unreleased lock somehow - from what I read this may be caused by an abort to the svnsync operation and I suspect it may be because in my post-commit hook I'm executing svnsync in blocking mode rather then pushing it into the background via &.

I do this so that the user can be sure that if the commit finished then it's in all repositories now but maybe it introduces a risk of them hitting cancel and stopping the commit hook?

I can't find clear guidelines or suggestions on which is better or what the best practice is or even if hitting cancel can cause an abort of the post commit hook and the sync executed from it - in most places I see people using & to kick of the sync in the background - does this prevent the lock corruption in case a user presses cancel to his commit while the sync is in progress? How do you make sure both repositories are really in sync or report issues? Do you need a separate notification mechanism for that?

Update:

From the two above options I decided to chose the third ;)

I'm calling svnsync in the background but at the same time I make the hook wait for it to finish:

svnsync ... &
wait $!

I think this nicely joins the best of both worlds but time will show how effective it'll be - please let me know what you think about the whole issue and what suggestions you might have to share about it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

腹黑女流氓 2024-09-23 20:13:52

顾名思义,提交后挂钩在完成提交并在源存储库中创建新修订后运行。那么问题是:谁应该如何按下“中止”按钮?另一方面,为什么要进行阻塞操作呢?我会同步,例如每 15 分钟等一次,与提交无关...如果你真的是新的另一种方式,那么 Write-Through-Proxy 怎么样?
最重要的问题是为什么每次提交都需要这样的同步?

The post commit hook as the name implies runs after the complete commit and new revision in the source repository has been created. So the questions is: Who should how press the "abort" button? On the other hand why do you do a blocking operation? I would synchronize e.g. every 15 Minutes etc. independant of the commit...If you really new the other way what about Write-Through-Proxy ?
The most important questions is why do you need a such synchronization with every commit?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文