Commit b81e8f4
committed
Asynchronous Handling Issue in API Key Hashing Middleware
Previously, next() was being called after hashing each API key, which caused multiple calls and issues.
The new solution uses a pendingTasks counter to wait until all async operations are completed.
This fix prevents Mongoose errors and premature next() calls, ensuring proper API key hashing.1 parent 2f99876 commit b81e8f4
1 file changed
+25
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | 119 | | |
121 | 120 | | |
122 | | - | |
123 | | - | |
| 121 | + | |
124 | 122 | | |
| 123 | + | |
125 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
126 | 140 | | |
127 | 141 | | |
128 | 142 | | |
| 143 | + | |
129 | 144 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
| 145 | + | |
135 | 146 | | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 147 | + | |
140 | 148 | | |
141 | | - | |
| 149 | + | |
142 | 150 | | |
143 | 151 | | |
144 | 152 | | |
145 | 153 | | |
146 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
147 | 158 | | |
148 | 159 | | |
149 | 160 | | |
| |||
0 commit comments