# PostActionType의 스레드 안전하지 않은 지연 초기화

**URL:** <https://meta.discourse.org/t/thread-unsafe-lazy-initialization-in-postactiontype/225447>\
**Category:** Bug\
**Created:** [4월 27, 2022, 3: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:** 1

<div class="post-metadata">

**Author:** ![bjfish](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bjfish/32/188318_2.png) [@bjfish](https://meta.discourse.org/u/bjfish)\
**Post date:** [4월 27, 2022, 3:28오후 UTC](https://meta.discourse.org/t/thread-unsafe-lazy-initialization-in-postactiontype/225447/1 "2022-04-27T15:28:22Z")

</div>

멀티스레드 Ruby 구현 및 서버(TruffleRuby/Puma)에서 discourse를 사용할 때, 플래그 설정의 안전하지 않은 해시 사용으로 인해 오류가 발생합니다. 이러한 지연 초기화 패턴은 두 번의 할당을 피해야 합니다:

> <https://github.com/discourse/discourse/blob/14b09c9909e9f161136218ba08c937d6adee60ba/app/models/post_action_type.rb#L17>

---

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