From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id A1F111F487 for ; Fri, 3 Apr 2020 20:48:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728359AbgDCUs2 (ORCPT ); Fri, 3 Apr 2020 16:48:28 -0400 Received: from mail-ed1-f51.google.com ([209.85.208.51]:41148 "EHLO mail-ed1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728288AbgDCUs0 (ORCPT ); Fri, 3 Apr 2020 16:48:26 -0400 Received: by mail-ed1-f51.google.com with SMTP id v1so10891668edq.8 for ; Fri, 03 Apr 2020 13:48:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=message-id:in-reply-to:references:from:date:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=3FyPP/kCWbFAk1FnlwSyBdfh3VeWDnsAloBBrdfXSFE=; b=PRQVc3sDHmrl8zhW5469ZZgarK9UcvVJhzZZ5/47CGy4zlVxO2x4wCxGz6TuvtxO4S jYdHEs6+6g+JYb9xo2hlfuBuOCPadrrtTcGSHxx6EFCCqZ5orIrubRPmCC1CdIemPB8o 8XH2UAot9Pc2Nrz478J7hykV/t475pVK4uafJSZBQNVxGVZAloyLujE+0N9cY93sGVU+ rzBnzwPW4amuSxNzDuhU1xChF1LK9nRiQhvIIbtGVr5VUr2R5iX2iNNf6yPxDEQbEOz4 YjjgF4JXymM7uvFo6fkjnLwXXuu6r/UZ+BpG08mDQa0CAKg36QDdiZXCKeNByUiOK5Yh CyMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:in-reply-to:references:from:date :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=3FyPP/kCWbFAk1FnlwSyBdfh3VeWDnsAloBBrdfXSFE=; b=XGw3q2oOpTXAbjn/AsVEqojHFw44RgJIKBOQrGqfqsUJBQESqFa4FFRf9Gw7tQ2XHY UriQn9q47+dmDOkSTxUUkXT+VSQtBOHzOtKUF7mHcPt8kB14tc3FRSG5yLhr0tIQhi1g J6sSZGwypth5VlKXnylHr77df7YbgKRr5as8zPeEwq0T6V+9hVIlrzn6UHqA5YAbBYa1 h61bNZ1gWeFiacsyyK0CEyXydAtygph9umoUP5uYckjTI9tcdJAjWPW/ZF9GQuoldtzW hdXTCWLYyeRNEh3YwSjeb5o0YGXGeHagUc7cUjeOuIY2gOWgxRIq9Io+TheD51v7nRdt uxpQ== X-Gm-Message-State: AGi0PuZzSLobfaAF76SDyeIdN47ClKMaQTigI7qk31JiPprQ5fuxCQQB DEbxrGqXNTLQFqyop5O7IvWTOvRa X-Google-Smtp-Source: APiQypKuJ7+QoGB3Vxe1ehlnXeCLKmHHNqWQdVcm0cVh5FDuiGWP1Ibu78QWrEiJ7ulMs4QYbF0nUw== X-Received: by 2002:a17:906:1613:: with SMTP id m19mr10083532ejd.265.1585946903510; Fri, 03 Apr 2020 13:48:23 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id w3sm14507ejf.21.2020.04.03.13.48.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Apr 2020 13:48:23 -0700 (PDT) Message-Id: <18429182ffcf4cb56fcf3d8c76e41652a6c45adc.1585946894.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Derrick Stolee via GitGitGadget" Date: Fri, 03 Apr 2020 20:48:09 +0000 Subject: [PATCH 10/15] job-runner: use config to limit job frequency Fcc: Sent Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MIME-Version: 1.0 To: git@vger.kernel.org Cc: peff@peff.net, jrnieder@google.com, stolee@gmail.com, Derrick Stolee , Derrick Stolee Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Derrick Stolee We want to run different maintenance tasks at different rates. That means we cannot rely only on the time between job-runner loop pauses to reduce the frequency of specific jobs. This means we need to persist a timestamp for the previous run somewhere. A natural place is the Git config file for that repo. Create the job..lastRun config option to store the timestamp of the previous run of that job. Set this config option after a successful run of 'git -C run-job '. To maximize code reuse, we dynamically construct the config key and parse the config value into a timestamp in a generic way. This makes the introduction of another config option extremely trivial: The job..interval option allows a user to specify a minimum number of seconds between two calls to 'git run-job ' on a given repo. This could be stored in the global or system config to provide an update on the default for all repos, or could be updated on a per-repo basis. This is checked on every iteration of the job loop, so a user could update this and see the effect without restarting the job-runner process. RFC QUESTION: I'm using a 'git -C config