{"action":"created","comment":{"url":"https://api.github.com/repos/wiremod/wire/pulls/comments/44134222","id":44134222,"diff_hunk":"@@ -584,3 +584,51 @@ function MakeWireExpression2(player, Pos, Ang, model, buffer, name, inputs, outp\n \treturn self\n end\n duplicator.RegisterEntityClass(\"gmod_wire_expression2\", MakeWireExpression2, \"Pos\", \"Ang\", \"Model\", \"_original\", \"_name\", \"_inputs\", \"_outputs\", \"_vars\", \"inc_files\", \"filepath\")\n+\n+--------------------------------------------------\n+-- Emergency shutdown (beta testing so far)\n+--------------------------------------------------\n+local average_ram = 0\n+local enable = CreateConVar( \n+\t\"wire_expression2_ram_emergency_shutdown_enable\", \"0\", {FCVAR_ARCHIVE}, \n+\t\"Enable/disable the emergency shutdown feature. Requires map reload after change.\" )\n+\n+local average_halt_multiplier = CreateConVar( \n+\t\"wire_expression2_ram_emergency_shutdown_spike\", \"4\", {FCVAR_ARCHIVE}, \n+\t\"if (current_ram > average_ram * spike_convar) then shut down all E2s\" )\n+\n+local halt_max_amount = CreateConVar( \n+\t\"wire_expression2_ram_emergency_shutdown_total\", \"512\", {FCVAR_ARCHIVE}, \n+\t\"This is in kilobytes, if (current_ram > total_convar) then shut down all E2s\" )\n+\n+if enable:GetBool() then\n+\thook.Remove( \"Think\", \"wire_expression2_emergency_shutdown\" ) -- remove old hook","path":"lua/entities/gmod_wire_expression2/init.lua","position":22,"original_position":22,"commit_id":"a2f9fafcc25a9692faca8633fd68cbe79ab0565c","original_commit_id":"a2f9fafcc25a9692faca8633fd68cbe79ab0565c","user":{"login":"AbigailBuccaneer","id":908758,"avatar_url":"https://avatars.githubusercontent.com/u/908758?v=3","gravatar_id":"","url":"https://api.github.com/users/AbigailBuccaneer","html_url":"https://github.com/AbigailBuccaneer","followers_url":"https://api.github.com/users/AbigailBuccaneer/followers","following_url":"https://api.github.com/users/AbigailBuccaneer/following{/other_user}","gists_url":"https://api.github.com/users/AbigailBuccaneer/gists{/gist_id}","starred_url":"https://api.github.com/users/AbigailBuccaneer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AbigailBuccaneer/subscriptions","organizations_url":"https://api.github.com/users/AbigailBuccaneer/orgs","repos_url":"https://api.github.com/users/AbigailBuccaneer/repos","events_url":"https://api.github.com/users/AbigailBuccaneer/events{/privacy}","received_events_url":"https://api.github.com/users/AbigailBuccaneer/received_events","type":"User","site_admin":false},"body":"@Divran https://github.com/garrynewman/garrysmod/blob/974f6ce8ed8a50f854179507435e3d4fe1176f46/garrysmod/lua/includes/modules/hook.lua#L47 it should work perfectly fine.","created_at":"2015-11-06T13:10:19Z","updated_at":"2015-11-06T13:10:19Z","html_url":"https://github.com/wiremod/wire/pull/964#discussion_r44134222","pull_request_url":"https://api.github.com/repos/wiremod/wire/pulls/964","_links":{"self":{"href":"https://api.github.com/repos/wiremod/wire/pulls/comments/44134222"},"html":{"href":"https://github.com/wiremod/wire/pull/964#discussion_r44134222"},"pull_request":{"href":"https://api.github.com/repos/wiremod/wire/pulls/964"}}},"pull_request":{"url":"https://api.github.com/repos/wiremod/wire/pulls/964","id":44861959,"html_url":"https://github.com/wiremod/wire/pull/964","diff_url":"https://github.com/wiremod/wire/pull/964.diff","patch_url":"https://github.com/wiremod/wire/pull/964.patch","issue_url":"https://api.github.com/repos/wiremod/wire/issues/964","number":964,"state":"open","locked":false,"title":"Added emergency E2 shutdown","user":{"login":"Divran","id":1485728,"avatar_url":"https://avatars.githubusercontent.com/u/1485728?v=3","gravatar_id":"","url":"https://api.github.com/users/Divran","html_url":"https://github.com/Divran","followers_url":"https://api.github.com/users/Divran/followers","following_url":"https://api.github.com/users/Divran/following{/other_user}","gists_url":"https://api.github.com/users/Divran/gists{/gist_id}","starred_url":"https://api.github.com/users/Divran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Divran/subscriptions","organizations_url":"https://api.github.com/users/Divran/orgs","repos_url":"https://api.github.com/users/Divran/repos","events_url":"https://api.github.com/users/Divran/events{/privacy}","received_events_url":"https://api.github.com/users/Divran/received_events","type":"User","site_admin":false},"body":"This feature is off by default, and will immediately halt the execution\r\nand clear the memories of all E2s on the server if RAM usage spikes or\r\nif the server's RAM usage becomes dangerously high.\r\n\r\nI got the values by trial and error on a local server, so they might not\r\nbe optimal for larger dedicated servers, but that's why it's off by\r\ndefault.","created_at":"2015-09-12T21:51:33Z","updated_at":"2015-11-06T13:10:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6231cc47ff4f8da03f13b1791145d9001d8d173f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wiremod/wire/pulls/964/commits","review_comments_url":"https://api.github.com/repos/wiremod/wire/pulls/964/comments","review_comment_url":"https://api.github.com/repos/wiremod/wire/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wiremod/wire/issues/964/comments","statuses_url":"https://api.github.com/repos/wiremod/wire/statuses/a2f9fafcc25a9692faca8633fd68cbe79ab0565c","head":{"label":"wiremod:emergency-shutdown-beta","ref":"emergency-shutdown-beta","sha":"a2f9fafcc25a9692faca8633fd68cbe79ab0565c","user":{"login":"wiremod","id":113164,"avatar_url":"https://avatars.githubusercontent.com/u/113164?v=3","gravatar_id":"","url":"https://api.github.com/users/wiremod","html_url":"https://github.com/wiremod","followers_url":"https://api.github.com/users/wiremod/followers","following_url":"https://api.github.com/users/wiremod/following{/other_user}","gists_url":"https://api.github.com/users/wiremod/gists{/gist_id}","starred_url":"https://api.github.com/users/wiremod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wiremod/subscriptions","organizations_url":"https://api.github.com/users/wiremod/orgs","repos_url":"https://api.github.com/users/wiremod/repos","events_url":"https://api.github.com/users/wiremod/events{/privacy}","received_events_url":"https://api.github.com/users/wiremod/received_events","type":"Organization","site_admin":false},"repo":{"id":4248640,"name":"wire","full_name":"wiremod/wire","owner":{"login":"wiremod","id":113164,"avatar_url":"https://avatars.githubusercontent.com/u/113164?v=3","gravatar_id":"","url":"https://api.github.com/users/wiremod","html_url":"https://github.com/wiremod","followers_url":"https://api.github.com/users/wiremod/followers","following_url":"https://api.github.com/users/wiremod/following{/other_user}","gists_url":"https://api.github.com/users/wiremod/gists{/gist_id}","starred_url":"https://api.github.com/users/wiremod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wiremod/subscriptions","organizations_url":"https://api.github.com/users/wiremod/orgs","repos_url":"https://api.github.com/users/wiremod/repos","events_url":"https://api.github.com/users/wiremod/events{/privacy}","received_events_url":"https://api.github.com/users/wiremod/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wiremod/wire","description":"Garry's Mod add-on that allows users to wire up components in order to make more elaborate automatic and user-controlled contraptions.","fork":false,"url":"https://api.github.com/repos/wiremod/wire","forks_url":"https://api.github.com/repos/wiremod/wire/forks","keys_url":"https://api.github.com/repos/wiremod/wire/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wiremod/wire/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wiremod/wire/teams","hooks_url":"https://api.github.com/repos/wiremod/wire/hooks","issue_events_url":"https://api.github.com/repos/wiremod/wire/issues/events{/number}","events_url":"https://api.github.com/repos/wiremod/wire/events","assignees_url":"https://api.github.com/repos/wiremod/wire/assignees{/user}","branches_url":"https://api.github.com/repos/wiremod/wire/branches{/branch}","tags_url":"https://api.github.com/repos/wiremod/wire/tags","blobs_url":"https://api.github.com/repos/wiremod/wire/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wiremod/wire/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wiremod/wire/git/refs{/sha}","trees_url":"https://api.github.com/repos/wiremod/wire/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wiremod/wire/statuses/{sha}","languages_url":"https://api.github.com/repos/wiremod/wire/languages","stargazers_url":"https://api.github.com/repos/wiremod/wire/stargazers","contributors_url":"https://api.github.com/repos/wiremod/wire/contributors","subscribers_url":"https://api.github.com/repos/wiremod/wire/subscribers","subscription_url":"https://api.github.com/repos/wiremod/wire/subscription","commits_url":"https://api.github.com/repos/wiremod/wire/commits{/sha}","git_commits_url":"https://api.github.com/repos/wiremod/wire/git/commits{/sha}","comments_url":"https://api.github.com/repos/wiremod/wire/comments{/number}","issue_comment_url":"https://api.github.com/repos/wiremod/wire/issues/comments{/number}","contents_url":"https://api.github.com/repos/wiremod/wire/contents/{+path}","compare_url":"https://api.github.com/repos/wiremod/wire/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wiremod/wire/merges","archive_url":"https://api.github.com/repos/wiremod/wire/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wiremod/wire/downloads","issues_url":"https://api.github.com/repos/wiremod/wire/issues{/number}","pulls_url":"https://api.github.com/repos/wiremod/wire/pulls{/number}","milestones_url":"https://api.github.com/repos/wiremod/wire/milestones{/number}","notifications_url":"https://api.github.com/repos/wiremod/wire/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wiremod/wire/labels{/name}","releases_url":"https://api.github.com/repos/wiremod/wire/releases{/id}","created_at":"2012-05-07T10:55:50Z","updated_at":"2015-11-04T15:30:24Z","pushed_at":"2015-11-06T04:36:18Z","git_url":"git://github.com/wiremod/wire.git","ssh_url":"git@github.com:wiremod/wire.git","clone_url":"https://github.com/wiremod/wire.git","svn_url":"https://github.com/wiremod/wire","homepage":"http://www.wiremod.com","size":28541,"stargazers_count":218,"watchers_count":218,"language":"Lua","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":228,"mirror_url":null,"open_issues_count":79,"forks":228,"open_issues":79,"watchers":218,"default_branch":"master"}},"base":{"label":"wiremod:master","ref":"master","sha":"8c2b6bfcd51a7f05ce010364219b26673a81df42","user":{"login":"wiremod","id":113164,"avatar_url":"https://avatars.githubusercontent.com/u/113164?v=3","gravatar_id":"","url":"https://api.github.com/users/wiremod","html_url":"https://github.com/wiremod","followers_url":"https://api.github.com/users/wiremod/followers","following_url":"https://api.github.com/users/wiremod/following{/other_user}","gists_url":"https://api.github.com/users/wiremod/gists{/gist_id}","starred_url":"https://api.github.com/users/wiremod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wiremod/subscriptions","organizations_url":"https://api.github.com/users/wiremod/orgs","repos_url":"https://api.github.com/users/wiremod/repos","events_url":"https://api.github.com/users/wiremod/events{/privacy}","received_events_url":"https://api.github.com/users/wiremod/received_events","type":"Organization","site_admin":false},"repo":{"id":4248640,"name":"wire","full_name":"wiremod/wire","owner":{"login":"wiremod","id":113164,"avatar_url":"https://avatars.githubusercontent.com/u/113164?v=3","gravatar_id":"","url":"https://api.github.com/users/wiremod","html_url":"https://github.com/wiremod","followers_url":"https://api.github.com/users/wiremod/followers","following_url":"https://api.github.com/users/wiremod/following{/other_user}","gists_url":"https://api.github.com/users/wiremod/gists{/gist_id}","starred_url":"https://api.github.com/users/wiremod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wiremod/subscriptions","organizations_url":"https://api.github.com/users/wiremod/orgs","repos_url":"https://api.github.com/users/wiremod/repos","events_url":"https://api.github.com/users/wiremod/events{/privacy}","received_events_url":"https://api.github.com/users/wiremod/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wiremod/wire","description":"Garry's Mod add-on that allows users to wire up components in order to make more elaborate automatic and user-controlled contraptions.","fork":false,"url":"https://api.github.com/repos/wiremod/wire","forks_url":"https://api.github.com/repos/wiremod/wire/forks","keys_url":"https://api.github.com/repos/wiremod/wire/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wiremod/wire/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wiremod/wire/teams","hooks_url":"https://api.github.com/repos/wiremod/wire/hooks","issue_events_url":"https://api.github.com/repos/wiremod/wire/issues/events{/number}","events_url":"https://api.github.com/repos/wiremod/wire/events","assignees_url":"https://api.github.com/repos/wiremod/wire/assignees{/user}","branches_url":"https://api.github.com/repos/wiremod/wire/branches{/branch}","tags_url":"https://api.github.com/repos/wiremod/wire/tags","blobs_url":"https://api.github.com/repos/wiremod/wire/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wiremod/wire/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wiremod/wire/git/refs{/sha}","trees_url":"https://api.github.com/repos/wiremod/wire/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wiremod/wire/statuses/{sha}","languages_url":"https://api.github.com/repos/wiremod/wire/languages","stargazers_url":"https://api.github.com/repos/wiremod/wire/stargazers","contributors_url":"https://api.github.com/repos/wiremod/wire/contributors","subscribers_url":"https://api.github.com/repos/wiremod/wire/subscribers","subscription_url":"https://api.github.com/repos/wiremod/wire/subscription","commits_url":"https://api.github.com/repos/wiremod/wire/commits{/sha}","git_commits_url":"https://api.github.com/repos/wiremod/wire/git/commits{/sha}","comments_url":"https://api.github.com/repos/wiremod/wire/comments{/number}","issue_comment_url":"https://api.github.com/repos/wiremod/wire/issues/comments{/number}","contents_url":"https://api.github.com/repos/wiremod/wire/contents/{+path}","compare_url":"https://api.github.com/repos/wiremod/wire/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wiremod/wire/merges","archive_url":"https://api.github.com/repos/wiremod/wire/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wiremod/wire/downloads","issues_url":"https://api.github.com/repos/wiremod/wire/issues{/number}","pulls_url":"https://api.github.com/repos/wiremod/wire/pulls{/number}","milestones_url":"https://api.github.com/repos/wiremod/wire/milestones{/number}","notifications_url":"https://api.github.com/repos/wiremod/wire/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wiremod/wire/labels{/name}","releases_url":"https://api.github.com/repos/wiremod/wire/releases{/id}","created_at":"2012-05-07T10:55:50Z","updated_at":"2015-11-04T15:30:24Z","pushed_at":"2015-11-06T04:36:18Z","git_url":"git://github.com/wiremod/wire.git","ssh_url":"git@github.com:wiremod/wire.git","clone_url":"https://github.com/wiremod/wire.git","svn_url":"https://github.com/wiremod/wire","homepage":"http://www.wiremod.com","size":28541,"stargazers_count":218,"watchers_count":218,"language":"Lua","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":228,"mirror_url":null,"open_issues_count":79,"forks":228,"open_issues":79,"watchers":218,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wiremod/wire/pulls/964"},"html":{"href":"https://github.com/wiremod/wire/pull/964"},"issue":{"href":"https://api.github.com/repos/wiremod/wire/issues/964"},"comments":{"href":"https://api.github.com/repos/wiremod/wire/issues/964/comments"},"review_comments":{"href":"https://api.github.com/repos/wiremod/wire/pulls/964/comments"},"review_comment":{"href":"https://api.github.com/repos/wiremod/wire/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wiremod/wire/pulls/964/commits"},"statuses":{"href":"https://api.github.com/repos/wiremod/wire/statuses/a2f9fafcc25a9692faca8633fd68cbe79ab0565c"}}}}