Skip to content

Add a time debounce property #31

@10hendersonm

Description

@10hendersonm

It'd be cool if blocks could only be updated every so often, so as to prevent long operations from being run all the time. For example, in our product markdown-inject runs on precommit, but it could be beneficial to have some emitted blocks of some components' npm run build output. It's not really something that changes so often that it need be evaluated every time, but running it every month or two could be nice.

<!--
  CODEBLOCK_START
  {
    "type": "command",
    "debounce": "1 month",
    "value": "npm run build"
  }
-->

To reduce complication / dependencies, the debounce property could instead take a number of minutes (43200), seconds (2592000), milliseconds (2592000), or something.

Then, markdown-inject would automatically inject a last-update property into the JSON config when it runs for that block:

<!--
  CODEBLOCK_START
  {
    "type": "command",
    "debounce": "1 month",
    "value": "npm run build",
    "last-update": "2021-11-23T22:43:35.339Z"
  }
-->

Preferably this date would be captured with new Date().toISOString() so the date is both easily machine parseable, but also decently human readable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions