Commit ff16850
fix: cache chat_id after reading from file
Hey, good catch on the review! I added caching for the chat_id so we don't
read the file every single time. Now it checks if we've already got the
value cached and only reads from disk if we haven't seen it before.
- Added getChatID() method that returns cached value first
- Cache the chat_id in n.conf.ChatID after reading it from file
- Changed Notify() to call getChatID() instead of accessing ChatID directly
Signed-off-by: Andrew Leng <tennisleng@users.noreply.github.com>1 parent 13845e5 commit ff16850
1 file changed
+11
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
141 | 147 | | |
142 | 148 | | |
143 | 149 | | |
144 | 150 | | |
145 | 151 | | |
146 | | - | |
147 | | - | |
| 152 | + | |
148 | 153 | | |
149 | 154 | | |
150 | 155 | | |
| 156 | + | |
| 157 | + | |
151 | 158 | | |
152 | 159 | | |
153 | | - | |
| 160 | + | |
| 161 | + | |
154 | 162 | | |
0 commit comments