From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from am.mirrors.kernel.org (am.mirrors.kernel.org [IPv6:2604:1380:4601:e00::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 03F261F44D for ; Mon, 18 Mar 2024 15:33:47 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=pass (2048-bit key; unprotected) header.d=max.gautier.name header.i=@max.gautier.name header.a=rsa-sha256 header.s=fdn header.b=pcOB6DCM; dkim-atps=neutral Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id A3B461F204C3 for ; Mon, 18 Mar 2024 15:33:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B7AFC53378; Mon, 18 Mar 2024 15:33:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=max.gautier.name header.i=@max.gautier.name header.b="pcOB6DCM" Received: from taslin.fdn.fr (taslin.fdn.fr [80.67.169.77]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B205C524A7 for ; Mon, 18 Mar 2024 15:33:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.67.169.77 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710776000; cv=none; b=YvMa/Otq5QGCVuzg0cw/bm2z1+CmmL8/p7Fusmshz6d4jCgGxZYYZCBaOdjYSJVbwqLJKvsqA0BHAznGAao4obc5/1hfmfDeUFjPcyW5nlS2ndL6oF+G+t+YkdPLWg35TLszZCfU1jGiRSzUG7xfy7wR6vYp+nXpk/y6c54YtLo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710776000; c=relaxed/simple; bh=1BsXbTaDlKvzIFO4QQuoq9BKtOXcTbpTbxBsq08BXHU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fbORI7W/ob0GZ9MxQcOxrKlpfDOJ+WFvKcjpFbXShK38t/PDCtJrqeYsD5iLvRSkO2kZq1t5lKnG8edFBgFs5+8AtAqi+/qOTSFyJxXvERpQR76HO/PKfdflY5vPxFw9bCvwm1TDOr7slqOM87yXWeEfGAj7JZYpSnMYzB4f31Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=max.gautier.name; spf=pass smtp.mailfrom=max.gautier.name; dkim=pass (2048-bit key) header.d=max.gautier.name header.i=@max.gautier.name header.b=pcOB6DCM; arc=none smtp.client-ip=80.67.169.77 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=max.gautier.name Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=max.gautier.name Received: from localhost (unknown [IPv6:2001:910:10ee:0:fc9:9524:11d1:7aa4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by taslin.fdn.fr (Postfix) with ESMTPSA id 3C86B6031B; Mon, 18 Mar 2024 16:33:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=max.gautier.name; s=fdn; t=1710775996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HknJ9NjDjqfl1sLk00t/bka3r/aYktT7hZyGtAU1Pz4=; b=pcOB6DCMoKs31fSjN4zJbt9MaUtzmKQAx863p4TxG+ngcOXvuH8TwOwnqlCD6O6xLsZpPY ptxLIMdXbXXJ34DIPPA4WEKkqiDWjsSAik1RcG1MYdBTzCYesGT4kR0RADcl3XRU4q2lxW iURwiWzy7XTI2KoQytNCv893jhiE61lhaXl2yAN2NGg6yHC1kYSwfhicasO6bjs8CahEyc RhVHfa7KqzMrXY2VHYZPt3PgXZk7M8qZM94AU/J01R9+BIbyV+/wGvhvnoJ3qmrq4Y+XiF RPMG9mMJYiz/WKcpq8I8gRDopMkuP2kW5hFGp6/1vjujva6cWVWg3BIoPtA9YA== From: Max Gautier To: git@vger.kernel.org Cc: =?UTF-8?q?L=C3=A9na=C3=AFc=20Huard?= , Derrick Stolee , Max Gautier Subject: [RFC PATCH 2/5] maintenance: add fixed random delay to systemd timers Date: Mon, 18 Mar 2024 16:31:16 +0100 Message-ID: <20240318153257.27451-3-mg@max.gautier.name> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240318153257.27451-1-mg@max.gautier.name> References: <20240318153257.27451-1-mg@max.gautier.name> Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Ensures that: - git maintenance timers have a fixed time interval between execution. - the three timers are not executed at the same time. This is intended to implement an alternative to the two followings commits: c97ec0378b (maintenance: fix systemd schedule overlaps, 2023-08-10) daa787010c (maintenance: use random minute in systemd scheduler, 2023-08-10) Instead of manually adding a specific minute (which is reset on each invocation of `git maintenance start`), we use systemd timers RandomizedDelaySec and FixedRandomDelay functionalities. >From man systemd.timer: >FixedRandomDelay= > Takes a boolean argument. When enabled, the randomized offset > specified by RandomizedDelaySec= is reused for all firings of the > same timer. For a given timer unit, **the offset depends on the > machine ID, user identifier and timer name**, which means that it is > stable between restarts of the manager. This effectively creates a > fixed offset for an individual timer, reducing the jitter in > firings of this timer, while still avoiding firing at the same time > as other similarly configured timers. -> which is exactly the use case for git-maintenance timers. Signed-off-by: Max Gautier --- systemd/user/git-maintenance@.service | 1 + systemd/user/git-maintenance@.timer | 3 +++ 2 files changed, 4 insertions(+) diff --git a/systemd/user/git-maintenance@.service b/systemd/user/git-maintenance@.service index 87ac0c86e6..f949e1a217 100644 --- a/systemd/user/git-maintenance@.service +++ b/systemd/user/git-maintenance@.service @@ -1,5 +1,6 @@ [Unit] Description=Optimize Git repositories data +Documentation=man:git-maintenance(1) [Service] Type=oneshot diff --git a/systemd/user/git-maintenance@.timer b/systemd/user/git-maintenance@.timer index 40fbc77a62..667c5998ba 100644 --- a/systemd/user/git-maintenance@.timer +++ b/systemd/user/git-maintenance@.timer @@ -1,9 +1,12 @@ [Unit] Description=Optimize Git repositories data +Documentation=man:git-maintenance(1) [Timer] OnCalendar=%i Persistent=true +RandomizedDelaySec=1800 +FixedRandomDelay=true [Install] WantedBy=timers.target -- 2.44.0