Skip to content

Commit 6f6b14d

Browse files
committed
Add the CloudI API function shutdown to all external service programming languages to allow external services a way to have a successful shutdown without using the CloudI Service API services_remove
1 parent f93c461 commit 6f6b14d

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

.travis.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
language: node_js
22
node_js:
3+
- "11"
4+
- "10"
5+
- "8"
36
- "6"
4-
- "6.1"
5-
- "5.11"
6-
- "4.1"
7+
- "4"
78
- "0.12"
89
- "0.10"
910
branches:

CloudI.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//
44
// MIT License
55
//
6-
// Copyright (c) 2014-2018 Michael Truog <mjtruog at protonmail dot com>
6+
// Copyright (c) 2014-2019 Michael Truog <mjtruog at protonmail dot com>
77
//
88
// Permission is hereby granted, free of charge, to any person obtaining a
99
// copy of this software and associated documentation files (the "Software"),
@@ -1053,6 +1053,17 @@ CloudI.API.prototype.poll = function (callback, timeout) {
10531053
}, 0);
10541054
};
10551055

1056+
CloudI.API.prototype.shutdown = function (callback, reason) {
1057+
callback = typeof callback !== 'undefined' ?
1058+
callback : function () {};
1059+
reason = typeof reason !== 'undefined' ?
1060+
reason : "";
1061+
this._poll_wait(function (API) {
1062+
API._send([new Erlang.OtpErlangAtom('shutdown'), reason]);
1063+
callback();
1064+
});
1065+
};
1066+
10561067
CloudI.API.prototype._text_key_value_parse = function (text) {
10571068
var result = {};
10581069
var data = text.toString('binary').split('\x00');

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2014-2018 Michael Truog <mjtruog at protonmail dot com>
3+
Copyright (c) 2014-2019 Michael Truog <mjtruog at protonmail dot com>
44

55
Permission is hereby granted, free of charge, to any person obtaining a
66
copy of this software and associated documentation files (the "Software"),

0 commit comments

Comments
 (0)