Skip to content

Commit

Permalink
[FSSDK-9951] add multi thread warning (#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewleap-optimizely authored Jan 17, 2024
1 parent 1333d60 commit 32d0d99
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ You can initialize the Optimizely instance in two ways: directly with a datafile
)
```

**Note:** The SDK spawns multiple threads when initialized. These threads have infinite loops that are used for fetching the datafile, as well as batching and dispatching events in the background. When using in a web server that spawn multiple child processes, you need to initialize the SDK after those child processes or workers have been spawned.

#### HTTP Config Manager

The `HTTPConfigManager` asynchronously polls for datafiles from a specified URL at regular intervals by making HTTP requests.
Expand Down
22 changes: 11 additions & 11 deletions lib/optimizely/event_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,17 @@ def get_common_params(project_config, user_id, attributes)
attributes&.each_key do |attribute_key|
# Omit attribute values that are not supported by the log endpoint.
attribute_value = attributes[attribute_key]
if Helpers::Validator.attribute_valid?(attribute_key, attribute_value)
attribute_id = project_config.get_attribute_id attribute_key
if attribute_id
visitor_attributes.push(
entity_id: attribute_id,
key: attribute_key,
type: CUSTOM_ATTRIBUTE_FEATURE_TYPE,
value: attribute_value
)
end
end
next unless Helpers::Validator.attribute_valid?(attribute_key, attribute_value)

attribute_id = project_config.get_attribute_id attribute_key
next unless attribute_id

visitor_attributes.push(
entity_id: attribute_id,
key: attribute_key,
type: CUSTOM_ATTRIBUTE_FEATURE_TYPE,
value: attribute_value
)
end
# Append Bot Filtering Attribute
if project_config.bot_filtering == true || project_config.bot_filtering == false
Expand Down

0 comments on commit 32d0d99

Please sign in to comment.