问题描述
我是一名初级开发人员,致力于Ruby on Rails应用程序,该应用程序在前端使用React。最近,我开始收到此错误,不知道是什么原因引起的。有没有人见过这个? enter image description here
如果图像未显示,这是终端回馈的信息:
2020-08-14T16:14:36.743Z 37931 TID-oxmbyiczg INFO: See LICENSE and the LGPL-3.0 for licensing details.
2020-08-14T16:14:36.743Z 37931 TID-oxmbyiczg INFO: Upgrade to Sidekiq Pro for more features and support: http://sidekiq.org
2020-08-14T16:14:36.743Z 37931 TID-oxmbyiczg INFO: Booting Sidekiq 5.0.5 with redis options {:id=>"Sidekiq-server-PID-37931",:url=>nil}
2020-08-14T16:14:36.748Z 37931 TID-oxmbyiczg INFO: Starting processing,hit Ctrl-C to stop
2020-08-14T16:14:36.757Z 37931 TID-oxmddbzao ERROR: heartbeat: "\xE2" from ASCII-8BIT to UTF-8
2020-08-14T16:14:41.773Z 37931 TID-oxmddbzao ERROR: heartbeat: "\xE2" from ASCII-8BIT to UTF-8
2020-08-14T16:14:46.776Z 37931 TID-oxmddbzao ERROR: heartbeat: "\xE2" from ASCII-8BIT to UTF-8
2020-08-14T16:14:51.783Z 37931 TID-oxmddbzao ERROR: heartbeat: "\xE2" from ASCII-8BIT to UTF-8```
解决方法
一点背景知识:processSets对工作程序进行迭代,然后他们每五秒钟向redis发送一次心跳,以检查正常运行时间和与redis实例的连接。
首先,我将检查服务器和客户端计算机上的Encoding::default_external
,并确保同时设置Encoding::UTF_8
。其次,确保在工作程序运行的位置的config.encoding = "utf-8"
中设置了application.rb
。
但是以上内容非常笼统,并不能解释您所看到的错误,该错误来自此代码块:
def ❤(key,data)
begin
# logic
rescue => e
# ignore all redis/network issues
logger.error("heartbeat: #{e.message}")
end
end
以上内容从heartbeat
中调用,而start_heartbeat
从run
中调用。用于心跳的密钥来自identity
(在Sidekiq存储库中)的util.rb
中的hostname
方法,而Socket.gethostname
来自调用Socket.gethostname
的方法,该方法执行所说的操作获取服务器的主机名,该主机名以平台特定的编码返回主机名。
因此,如果我们不得不走这么远的路,请找到运行该工作服务器的计算机的服务器名称,并启动一个控制台,然后检查应该解释错误的listViewDevices.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent,View view,int position,long id) {
//or showDeviceInfo(devices[position]);
showDeviceInfo(Names[position]); //whatever array you have for devices just get the item based on position and pass it
}
});
return root;
}
的编码值。