Skip to content

Commit

Permalink
release 1.5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
oowl committed Dec 22, 2023
1 parent 4972646 commit 52d9372
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 18 deletions.
11 changes: 6 additions & 5 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<h1>lua-resty-healthcheck</h1>



<h2>Contents</h2>
<ul>
<li><a href="#Functions">Functions</a></li>
Expand Down Expand Up @@ -86,7 +87,7 @@ <h2><a href="#Functions">Functions</a></h2>
<td class="name" nowrap><a href="#run_locked">run_locked (self, key, fn, ...)</a></td>
<td class="summary">Acquire a lock and run a function</p>

<p> The function call itself is wrapped with <a href="https://www.lua.org/manual/5.1/manual.html#pdf-pcall">pcall</a> to protect against
<p> The function call itself is wrapped with <a href="https://www.lua.org/manual/5.4/manual.html#pdf-pcall">pcall</a> to protect against
exception.</td>
</tr>
</table>
Expand Down Expand Up @@ -182,7 +183,7 @@ <h2 class="section-header "><a name="Functions"></a>Functions</h2>

<p>Acquire a lock and run a function</p>

<p> The function call itself is wrapped with <a href="https://www.lua.org/manual/5.1/manual.html#pdf-pcall">pcall</a> to protect against
<p> The function call itself is wrapped with <a href="https://www.lua.org/manual/5.4/manual.html#pdf-pcall">pcall</a> to protect against
exception. </p>

<p> This function exhibits some special behavior when called during a
Expand Down Expand Up @@ -286,7 +287,7 @@ <h3>Usage:</h3>
<span class="keyword">end</span>
<span class="keyword">end</span>

worker_events.register(event_callback, my_checker.EVENT_SOURCE)</pre>
worker_events.<span class="function-name">register</span>(event_callback, my_checker.EVENT_SOURCE)</pre>
</ul>

</dd>
Expand Down Expand Up @@ -829,8 +830,8 @@ <h3>Returns:</h3>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-11-14 18:51:21 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-12-22 15:52:45 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
34 changes: 21 additions & 13 deletions docs/topics/readme.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<h1>lua-resty-healthcheck</h1>



<h2>Contents</h2>
<ul>
<li><a href="#Synopsis">Synopsis </a></li>
Expand Down Expand Up @@ -64,23 +65,23 @@ <h2>Synopsis</h2>


<pre>
http {
<span class="function-name">http</span> {
lua_shared_dict test_shm <span class="number">8</span>m;
lua_shared_dict my_worker_events <span class="number">8</span>m;
init_worker_by_lua_block {
<span class="function-name">init_worker_by_lua_block</span> {

<span class="keyword">local</span> we = <span class="global">require</span> <span class="string">"resty.worker.events"</span>
<span class="keyword">local</span> ok, err = we.configure({
<span class="keyword">local</span> ok, err = we.<span class="function-name">configure</span>({
shm = <span class="string">"my_worker_events"</span>,
interval = <span class="number">0.1</span>
})
<span class="keyword">if</span> <span class="keyword">not</span> ok <span class="keyword">then</span>
ngx.log(ngx.ERR, <span class="string">"failed to configure worker events: "</span>, err)
ngx.<span class="function-name">log</span>(ngx.ERR, <span class="string">"failed to configure worker events: "</span>, err)
<span class="keyword">return</span>
<span class="keyword">end</span>

<span class="keyword">local</span> healthcheck = <span class="global">require</span>(<span class="string">"resty.healthcheck"</span>)
<span class="keyword">local</span> checker = healthcheck.new({
<span class="keyword">local</span> checker = healthcheck.<span class="function-name">new</span>({
name = <span class="string">"testing"</span>,
shm_name = <span class="string">"test_shm"</span>,
checks = {
Expand All @@ -99,21 +100,21 @@ <h2>Synopsis</h2>
}
})

<span class="keyword">local</span> ok, err = checker:add_target(<span class="string">"127.0.0.1"</span>, <span class="number">8080</span>, <span class="string">"example.com"</span>, <span class="keyword">false</span>)
<span class="keyword">local</span> ok, err = checker:<span class="function-name">add_target</span>(<span class="string">"127.0.0.1"</span>, <span class="number">8080</span>, <span class="string">"example.com"</span>, <span class="keyword">false</span>)

<span class="keyword">local</span> handler = <span class="keyword">function</span>(target, eventname, sourcename, pid)
ngx.log(ngx.DEBUG,<span class="string">"Event from: "</span>, sourcename)
ngx.<span class="function-name">log</span>(ngx.DEBUG,<span class="string">"Event from: "</span>, sourcename)
<span class="keyword">if</span> eventname == checker.events.remove
<span class="comment">-- a target was removed
</span> ngx.log(ngx.DEBUG,<span class="string">"Target removed: "</span>,
</span> ngx.<span class="function-name">log</span>(ngx.DEBUG,<span class="string">"Target removed: "</span>,
target.ip, <span class="string">":"</span>, target.port, <span class="string">" "</span>, target.hostname)
<span class="keyword">elseif</span> eventname == checker.events.healthy
<span class="comment">-- target changed state, or was added
</span> ngx.log(ngx.DEBUG,<span class="string">"Target switched to healthy: "</span>,
</span> ngx.<span class="function-name">log</span>(ngx.DEBUG,<span class="string">"Target switched to healthy: "</span>,
target.ip, <span class="string">":"</span>, target.port, <span class="string">" "</span>, target.hostname)
<span class="keyword">elseif</span> eventname == checker.events.unhealthy
<span class="comment">-- target changed state, or was added
</span> ngx.log(ngx.DEBUG,<span class="string">"Target switched to unhealthy: "</span>,
</span> ngx.<span class="function-name">log</span>(ngx.DEBUG,<span class="string">"Target switched to unhealthy: "</span>,
target.ip, <span class="string">":"</span>, target.port, <span class="string">" "</span>, target.hostname)
<span class="keyword">else</span>
<span class="comment">-- unknown event
Expand Down Expand Up @@ -148,6 +149,13 @@ <h2>History</h2>

<p>Versioning is strictly based on <a href="https://semver.org/">Semantic Versioning</a></p>

<h3>1.5.4 (22-Dec-2023)</h3>

<ul>
<li>Fix: fix delay clean logic when multiple healthchecker was
started <a href="https://github.com/Kong/lua-resty-healthcheck/pull/146">#146</a></li>
</ul>

<h3>1.5.3 (14-Nov-2022)</h3>

<ul>
Expand Down Expand Up @@ -295,7 +303,7 @@ <h3>0.5.0 (25-Jul-2018)</h3>
<ul>
<li>Add support for <code>https</code> -- thanks @gaetanfl for the PR!</li>
<li>Introduce separate <code>checks.active.type</code> and <code>checks.passive.type</code> fields;
the top-level <a href="https://www.lua.org/manual/5.1/manual.html#pdf-type">type</a> field is still supported as a fallback but is now
the top-level <a href="https://www.lua.org/manual/5.4/manual.html#pdf-type">type</a> field is still supported as a fallback but is now
deprecated.</li>
</ul>

Expand Down Expand Up @@ -360,8 +368,8 @@ <h2>Copyright and License</h2>
</div> <!-- id="content" -->
</div> <!-- id="main" -->
<div id="about">
<i>generated by <a href="http://github.com/stevedonovan/LDoc">LDoc 1.4.6</a></i>
<i style="float:right;">Last updated 2022-11-14 18:51:21 </i>
<i>generated by <a href="http://github.com/lunarmodules/LDoc">LDoc 1.5.0</a></i>
<i style="float:right;">Last updated 2023-12-22 15:52:45 </i>
</div> <!-- id="about" -->
</div> <!-- id="container" -->
</body>
Expand Down
5 changes: 5 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@ for the complete API.

Versioning is strictly based on [Semantic Versioning](https://semver.org/)

### 1.5.4 (22-Dec-2023)

* Fix: fix delay clean logic when multiple healthchecker was
started [#146](https://github.com/Kong/lua-resty-healthcheck/pull/146)

### 1.5.3 (14-Nov-2022)

* Fix: avoid raising worker events for new targets that were marked for delayed
Expand Down
27 changes: 27 additions & 0 deletions rockspecs/lua-resty-healthcheck-1.5.4-1.rockspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package = "lua-resty-healthcheck"
version = "1.5.4-1"
source = {
url = "https://github.com/Kong/lua-resty-healthcheck/archive/1.5.4.tar.gz",
dir = "lua-resty-healthcheck-1.5.4"
}
description = {
summary = "Healthchecks for OpenResty to check upstream service status",
detailed = [[
lua-resty-healthcheck is a module that can check upstream service
availability by sending requests and validating responses at timed
intervals.
]],
license = "Apache 2.0",
homepage = "https://github.com/Kong/lua-resty-healthcheck"
}
dependencies = {
"lua-resty-worker-events == 1.0.0",
"penlight >= 1.9.2",
"lua-resty-timer ~> 1",
}
build = {
type = "builtin",
modules = {
["resty.healthcheck"] = "lib/resty/healthcheck.lua",
}
}

0 comments on commit 52d9372

Please sign in to comment.