Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command line option for disabling scheduled events. #1185

Merged
merged 2 commits into from Jan 25, 2022
Merged

Add command line option for disabling scheduled events. #1185

merged 2 commits into from Jan 25, 2022

Conversation

james-relyea
Copy link
Contributor

@james-relyea james-relyea commented Feb 23, 2021

Description

  • Add support for using --disableScheduledEvents from the command line to force all scheduled events to become disabled. Resolves Disable scheduled functions #1123.

  • Also included a fix for husky pre-commit lint error I was receiving while trying to create this PR by moving the :

> serverless-offline@6.8.0 lint /serverless-offline
> eslint .


/serverless-offline/src/lambda/LambdaFunction.js
  39:3  error  'status' is not defined  no-undef

✖ 1 problem (1 error, 0 warnings)

Motivation and Context

During development some of us are wanting to disable all scheduled events from being scheduled without also needing to modify our serverless.yml.

How Has This Been Tested?

Tested out a serverless.yml configuration with a scheduled event configuration:

  testEvent:
    handler: src/index.testEvent
    events:
      - schedule:
          enabled: true
          rate: rate(1 minute)
          
  testEvent2:
    handler: src/index.testEvent2
    events:
      - schedule:
          enabled: true
          rate: rate(2 minutes)
          
  testEvent3:
    handler: src/index.testEvent3
    events:
      - schedule:
          enabled: false
          rate: rate(5 minutes)

While starting with serverless offline --disableScheduledEvents, confirmed that none of the enabled events were triggered. With that option not specified, confirmed that testEvent1 and testEvent2 were triggered relative to their rate configuration.

@selected-pixel-jameson
Copy link

I'd love to see this released! Unfortunately even if it is released I'm unable to update until this issue, #1119, is addressed.

@selected-pixel-jameson
Copy link

Any reason this isn't being merged??

@james-relyea
Copy link
Contributor Author

Not sure - we need to get some eyes on this from maintainers and get a discussion going on whether this is a reasonable feature to add in.

Thoughts @medikoo @pgrzesik @dherault ?

@medikoo
Copy link
Collaborator

medikoo commented Oct 27, 2021

@james-relyea thanks for pinging. Can you rebase against master, so branch is up to date (?)

@fredrik
Copy link

fredrik commented Jan 19, 2022

This looks like a great enhancement! Could you please have a look at merging this, @medikoo @pgrzesik @dherault?

@james-relyea
Copy link
Contributor Author

I need to rebase and push this again - will do that today.

Copy link
Collaborator

@medikoo medikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @james-relyea it looks very good. I have just one comment

disableScheduledEvents: {
usage:
'Disables all scheduled events. Overrides configurations in serverless.yml.',
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It misses a type property

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, amended that.

Copy link
Collaborator

@medikoo medikoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, looks great 👍

@medikoo medikoo merged commit 15916f3 into dherault:master Jan 25, 2022
@mrollinsiv
Copy link

I see this was merged yesterday, do you have an ETA on when you'll be tagging master?

@medikoo
Copy link
Collaborator

medikoo commented Jan 31, 2022

@mrollinsiv new release went out on Friday

@cvanputt
Copy link

cvanputt commented Dec 9, 2023

was this feature ever merged? it is not available in 13.1

@throrin19
Copy link

The argument is shown in Serverless offline page : https://www.serverless.com/plugins/serverless-offline#usage-and-command-line-options but it's not present in main branch and is not available in latest version (13.3.3).

It is normal @medikoo ?

@medikoo
Copy link
Collaborator

medikoo commented Apr 12, 2024

@throrin19 I'm no longer maintaining this project. I believe it's @dnalborczyk who is covering it now, and can probably answer this question

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disable scheduled functions
7 participants