我一直收到错误消息:
2019-05-18T17:17:44.785307+00:00 heroku[web.1]: Process running mem=622M(121.6%)
2019-05-18T17:17:44.785432+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
视图上的代码是:
<%= javascript_include_tag "//static.opentok.com/webrtc/v2.2/js/TB.min.js" %>
<div id="videobox" style="position:relative; z-index:0; height: 500px"></div>
<hr style="margin-bottom: 5px; margin-top: 5px">
<script type="text/javascript">
var apiKey = '<%= Figaro.env.opentok_api_key %>';
var session_id = '<%= @stream.tokbox_session_id %>';
var token = '<%= @tok_token %>';
// (optional) add server code here
initializeSession();
// Handling all of our errors here by alerting them
function handleError(error) {
if (error) {
alert(error.message);
}
}
function initializeSession() {
var session = OT.initSession(apiKey, session_id, 'videobox');
// Create a publisher
var publisher = OT.initPublisher('publisher', 'videobox', {
insertMode: 'append',
width: 'auto', height: 500,
name: '<%= @stream.name %> ',
mirror: false
}, handleError);
// Connect to the session
session.connect(token, function (error) {
// If the connection is successful, publish to the session
if (error) {
handleError(error);
} else {
session.publish(publisher, handleError);
}
});
}
function myFunction() {
var copyText = document.getElementById("myInput");
copyText.select();
document.execCommand("copy");
var tooltip = document.getElementById("myTooltip");
tooltip.innerHTML = "Copied: " + copyText.value;
}
function outFunc() {
var tooltip = document.getElementById("myTooltip");
tooltip.innerHTML = "Copy to clipboard";
}
</script>
我的控制器也很简单:
[![def stream
@messages = Chatmessage.all
@videomotion = Videomotion.new(videomotion_params)
@opentok = OpenTok::OpenTok.new Figaro.env.opentok_api_key, Figaro.env.opentok_api_secret
@stream = Stream.find_by(user_id: current_user.id)
@tok_token = @opentok.generate_token(@stream.tokbox_session_id, :role => :publisher, :expire_time => 30.days.from_now)
end][1]][1]
这是在尝试加载一些视频项目时。
我尝试了到目前为止所能找到的一切:
JAVA_TOOL_OPTIONS -Xmx256m
RUBY_GC_HEAP_GROWTH_FACTOR1.03
WEB_CONCURRENCY 1
在我的heroku配置中设置。
我还升级到了专业Dynos。 有人知道我想念的吗?我按照Heroku帮助页面上的说明进行操作,没有运气。
答案 0 :(得分:0)
我最好的猜测是
@messages = Chatmessage.all
除非Chatmessage
具有默认作用域,否则它将把chatmessages
表中的每一行加载到内存中。