subversion-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Trent Nelson <tr...@snakebite.org>
Subject Re: Commit Hooks Asynchronous?
Date Fri, 03 Feb 2012 23:10:44 GMT
On Fri, Feb 03, 2012 at 02:42:49PM -0800, Cory Finger wrote:
> Hello, I was just curious. I am developing a script that involves both
> a pre-commit hook and a post commit hook.
>
> The post-commit hook opens a file, reads a file, and saves a file. I
> was wondering, do I need to set up a lock-file system to ensure that 2
> people committing at the same time will not cause a problem in the
> file writing process? Or do the commit hooks run asynchronously?

    Assuming you're writing to the same file name during each hook
    invocation, yes, you'll definitely need to introduce locking.

    Alternatively, you could write to a revision-specific file during
    post-commit, then have a little daemon that writes to the intended
    file sequentially, as files become available.

    If the time it takes you to process a commit is proportional to the
    size of a commit, your post-commit hooks will finish out of order.

    For example:
        Post commit for rev 6 (30MB delta) is running.
        Post commit for rev 7 (1 prop change) starts, finishes.
        Post commit for rev 6 finishes a minute later.

    Unless post-commit r7 logic depends on r6, I'd highly recommend
    the daemon approach over locking.

        Trent.

Mime
View raw message