# Thread-unsichere Lazy Initialization in PostActionType

**URL:** <https://meta.discourse.org/t/thread-unsafe-lazy-initialization-in-postactiontype/225447>\
**Category:** Bug\
**Created:** [27. April 2022 um 15:28 UTC](https://meta.discourse.org/t/thread-unsafe-lazy-initialization-in-postactiontype/225447 "2022-04-27T15:28:22Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2. Mai 2022 um 07:55 UTC](https://meta.discourse.org/t/thread-unsafe-lazy-initialization-in-postactiontype/225447/4 "2022-05-02T07:55:01Z")

</div>

Ehrlich gesagt bin ich mir nicht sicher, ob diese Lazy-Initialisierung hier überhaupt Sinn macht, wir haben einen Hook für Plugins, um die gesamte Flaggenmenge zu ersetzen, aber das würde vor dem Initialisierer ausgelöst werden.

@roman, gibt es Bedenken bezüglich einer Eager-Initialisierung hier? Ich schätze, die triviale Lösung ist:

```plaintext
class << self

  def flag_settings
     ...
   end
end

flag_settings

```

Ich denke, der Hauptgrund dafür ist, dass Ruby kein sauberes Muster für Klasseninitialisierer liefert, was Entwickler dazu drängt, eigene zu erfinden/Lazy zu verwenden.

---

_[View the full topic](https://meta.discourse.org/t/thread-unsafe-lazy-initialization-in-postactiontype/225447)._
