-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't boot async subscribers in web mode.
- Loading branch information
Showing
5 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# frozen_string_literal: true | ||
|
||
module EventSource | ||
module Configure | ||
# Server boot mode. Used for performance and configuration settings. | ||
class Mode | ||
|
||
attr_reader :value | ||
|
||
def initialize(val) | ||
@value = val | ||
end | ||
|
||
def normal? | ||
@value == :normal | ||
end | ||
|
||
def web? | ||
@value == :web | ||
end | ||
|
||
def self.normal | ||
self.new(:normal) | ||
end | ||
|
||
def self.parse(mode_string) | ||
return normal if mode_string.blank? | ||
mode_sym = mode_string.to_sym | ||
raise ::EventSource::Error::InvalidModeError, "\"#{mode_string}\" is an invalid mode. Must be empty, null, \"normal\", or \"web\"." if ![:web, :normal].include?(mode_sym) | ||
self.new(mode_string.to_sym) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters