Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iterate peers as linked list instead of array #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

quezacoatl
Copy link

@quezacoatl quezacoatl commented Sep 20, 2018

Accessing peers as an array has been deprecated since nginx 1.9.0 (changeset 6100 - http://hg.nginx.org/nginx/rev/c44459611d91) and does not work when using the zone directive in upstream block. This commit changes iteration to use peer->next and iterate as a linked list.

This PR should solve #31 and #61

@quezacoatl
Copy link
Author

quezacoatl commented Sep 20, 2018

I got this reply when I asked regarding this in nginx-devel mailing list:


The ngx_lua_upstream module is not adapted to work with peers stored
in memory as a linked list, thus it cannot be used with upstream zone
that copies peers from configuration to shared memory one by one, thus
the peers' layout is effectively changed from an array to a linked list.
The problem you observe is that lua iterates peers by index as an array.

See this change as a guidance:
http://hg.nginx.org/nginx/rev/c44459611d91

Accessing peers as an array has been deprecated since nginx 1.9.0
(changeset 6100 - http://hg.nginx.org/nginx/rev/c44459611d91) and
does not work when using the "zone" directive in upstream. This commit
changes iteration to use peer->next and iterate as a linked list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant