AlinsRan commented on code in PR #13855:
URL: https://github.com/apache/apisix/pull/13855#discussion_r3869707719


##########
apisix/admin/standalone.lua:
##########
@@ -343,9 +346,12 @@ function _M.init_worker()
                 end
             else
                 local last_modified = config[METADATA_LAST_MODIFIED]
-                if last_modified_per_worker ~= last_modified then
+                local digest = config[METADATA_DIGEST]
+                if last_modified_per_worker ~= last_modified
+                   or digest_per_worker ~= digest then
                     update_config(config)

Review Comment:
   Agreed — TEST 1 only covers the `ip_port.lua` crash, the digest half is 
untested.
   
   The scenario as described can't be arranged deterministically, though: 
`X-Last-Modified` is server-generated (`ngx_time()`), so reproducing it needs 
both pushes inside one second *and* the poll to fire between them. That race 
can pass with the fix reverted and fail with it in place.
   
   What is deterministic: let one poll interval pass, then write the second 
config straight into the `standalone-config` shared dict — same timestamp, new 
digest, new content, no event posted. The poll is then the only thing that can 
deliver it. It doesn't need the stream subsystem either: 
`standalone.init_worker()` runs in both (`init.lua:140` and `:1371`), so this 
fits in `t/admin/standalone.t`.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to