Skip to content

Commit

Permalink
feat backend-cpp: fastcgi2 wrapper for uservices
Browse files Browse the repository at this point in the history
4c129d54a5227fe96b8f66b73b7d8f38179848e8
  • Loading branch information
segoon committed Jun 7, 2024
1 parent 9d3948e commit 79dffb0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
29 changes: 15 additions & 14 deletions core/include/userver/cache/cache_config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,32 @@ ConfigPatch Parse(const formats::json::Value& value,
formats::parse::To<ConfigPatch>);

struct Config final {
Config() = default;
explicit Config(const yaml_config::YamlConfig& config,
const std::optional<dump::Config>& dump_config);

Config MergeWith(const ConfigPatch& patch) const;

AllowedUpdateTypes allowed_update_types;
bool allow_first_update_failure;
AllowedUpdateTypes allowed_update_types{};
bool allow_first_update_failure{};
std::optional<bool> force_periodic_update;
bool config_updates_enabled;
bool has_pre_assign_check;
bool config_updates_enabled{};
bool has_pre_assign_check{};
std::optional<std::string> task_processor_name;
std::chrono::milliseconds cleanup_interval;
bool is_strong_period;
std::chrono::milliseconds cleanup_interval{};
bool is_strong_period{};
std::optional<std::uint64_t> failed_updates_before_expiration;

FirstUpdateMode first_update_mode;
FirstUpdateType first_update_type;
FirstUpdateMode first_update_mode{};
FirstUpdateType first_update_type{};

std::chrono::milliseconds update_interval;
std::chrono::milliseconds update_jitter;
std::chrono::milliseconds full_update_interval;
std::chrono::milliseconds full_update_jitter;
std::chrono::milliseconds update_interval{};
std::chrono::milliseconds update_jitter{};
std::chrono::milliseconds full_update_interval{};
std::chrono::milliseconds full_update_jitter{};
std::optional<std::chrono::milliseconds> exception_interval;
bool updates_enabled;
std::uint64_t alert_on_failing_to_update_times;
bool updates_enabled{};
std::uint64_t alert_on_failing_to_update_times{};
};

extern const dynamic_config::Key<std::unordered_map<std::string, ConfigPatch>>
Expand Down
13 changes: 7 additions & 6 deletions core/include/userver/testsuite/cache_control.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,21 @@ class CacheControl final {
template <typename Component>
CacheResetRegistration RegisterCache(Component* self, std::string_view name,
void (Component::*reset_method)());
/// @endcond
private:
friend class CacheResetRegistration;

struct CacheInfo final {
std::string name;
std::function<void(cache::UpdateType)> reset;
bool needs_span{true};
};

struct CacheInfoNode;
using CacheInfoIterator = CacheInfoNode*;

// For internal use only.
CacheInfoIterator DoRegisterCache(CacheInfo&& info);
/// @endcond
private:
friend class CacheResetRegistration;

class CacheResetJob;

void DoResetCaches(
Expand All @@ -126,8 +129,6 @@ class CacheControl final {
const std::unordered_set<std::string>& force_incremental_names,
const std::unordered_set<std::string>* exclude_names);

CacheInfoIterator DoRegisterCache(CacheInfo&& info);

void UnregisterCache(CacheInfoIterator) noexcept;

static void DoResetSingleCache(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,11 @@ def _mock_configs(request):

@mockserver.json_handler('/configs-service/configs/status')
def _mock_configs_status(_request):
return {'updated_at': dynamic_config_changelog.timestamp}
return {
'updated_at': dynamic_config_changelog.timestamp.strftime(
'%Y-%m-%dT%H:%M:%SZ',
),
}


@pytest.fixture
Expand Down

0 comments on commit 79dffb0

Please sign in to comment.