Commit b421ca1
authored
Add mutex to
This wraps `getSnapState` in a mutex, to ensure we only decrypt once
when calling it at the same time. The first call will decrypt the state
and cache it in the Snaps runtime, and the next call will just use the
cached result.getSnapState to prevent concurrent decryption (#3234)1 parent 92f8922 commit b421ca1
File tree
2 files changed
+30
-21
lines changed- packages/snaps-controllers
- src/snaps
2 files changed
+30
-21
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
286 | 286 | | |
287 | 287 | | |
288 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
289 | 294 | | |
290 | 295 | | |
291 | 296 | | |
| |||
2046 | 2051 | | |
2047 | 2052 | | |
2048 | 2053 | | |
2049 | | - | |
| 2054 | + | |
| 2055 | + | |
2050 | 2056 | | |
2051 | | - | |
2052 | | - | |
2053 | | - | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
2054 | 2060 | | |
2055 | | - | |
2056 | | - | |
2057 | | - | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
2058 | 2064 | | |
2059 | | - | |
2060 | | - | |
2061 | | - | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
2062 | 2068 | | |
2063 | | - | |
2064 | | - | |
2065 | | - | |
2066 | | - | |
2067 | | - | |
| 2069 | + | |
| 2070 | + | |
| 2071 | + | |
| 2072 | + | |
| 2073 | + | |
2068 | 2074 | | |
2069 | | - | |
2070 | | - | |
| 2075 | + | |
| 2076 | + | |
2071 | 2077 | | |
2072 | | - | |
2073 | | - | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
2074 | 2081 | | |
2075 | | - | |
| 2082 | + | |
| 2083 | + | |
2076 | 2084 | | |
2077 | 2085 | | |
2078 | 2086 | | |
| |||
3968 | 3976 | | |
3969 | 3977 | | |
3970 | 3978 | | |
| 3979 | + | |
3971 | 3980 | | |
3972 | 3981 | | |
3973 | 3982 | | |
| |||
0 commit comments