Skip to content

Commit

Permalink
清理精简数据表
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Oct 9, 2024
1 parent b1afb15 commit 8046ec3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,7 @@ public void executeAnnounce(PeerAnnounce announce) {
announce.peerEvent().ordinal(),
ByteUtil.filterUTF8(announce.userAgent()),
OffsetDateTime.now(),
jacksonObjectMapper.writeValueAsString(geoIPManager.geoData(announce.peerIp())),
jacksonObjectMapper.writeValueAsString(geoIPManager.geoData(announce.reqIp()))
jacksonObjectMapper.writeValueAsString(geoIPManager.geoData(announce.peerIp()))
);
}
} catch (InterruptedException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,4 @@ public class TrackedPeer {
@Type(JsonType.class)
@Basic(fetch = FetchType.LAZY)
private IPGeoData peerGeoIP;
@Column(columnDefinition = "jsonb")
@Type(JsonType.class)
@Basic(fetch = FetchType.LAZY)
private IPGeoData requestGeoIP;
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ order by RANDOM() limit ?3
@Modifying
@Query(value = """
INSERT INTO tracker_peers (req_ip, peer_id, peer_id_human_readable, peer_ip, peer_port, torrent_info_hash, uploaded_offset, downloaded_offset, "left", last_event, user_agent, last_time_seen, peer_geoip, request_geoip, version) \
VALUES (:reqIp, :peerId, :peerIdHumanReadable, :peerIp, :peerPort, :torrentInfoHash, :uploadedOffset, :downloadedOffset, :left, :lastEvent, :userAgent, :lastTimeSeen, CAST(:peerGeoIP AS jsonb), CAST(:requestGeoIP AS jsonb), :version) \
VALUES (:reqIp, :peerId, :peerIdHumanReadable, :peerIp, :peerPort, :torrentInfoHash, :uploadedOffset, :downloadedOffset, :left, :lastEvent, :userAgent, :lastTimeSeen, CAST(:peerGeoIP AS jsonb)) \
ON CONFLICT (peer_id, torrent_info_hash) DO UPDATE SET \
uploaded_offset = EXCLUDED.uploaded_offset, \
downloaded_offset = EXCLUDED.downloaded_offset, \
Expand All @@ -54,8 +54,7 @@ void upsertTrackedPeer(@Param("reqIp") InetAddress reqIp,
@Param("lastEvent") int lastEvent,
@Param("userAgent") String userAgent,
@Param("lastTimeSeen") OffsetDateTime lastTimeSeen,
@Param("peerGeoIP") String peerGeoIP,
@Param("requestGeoIP") String requestGeoIP);
@Param("peerGeoIP") String peerGeoIP);

void deleteByPk_PeerIdAndPk_TorrentInfoHash(String peerId, String infoHash);

Expand Down

0 comments on commit 8046ec3

Please sign in to comment.