public static void mainDropInvalidIssues()

in ignite-tc-helper-web/src/main/java/org/apache/ignite/ci/runners/RemoteClientTmpHelper.java [94:141]


    public static void mainDropInvalidIssues(String[] args) {
        try (Ignite ignite = tcbotServerConnectedClient()) {
            IgniteCache<IssueKey, Issue>  bst = ignite.cache(IssuesStorage.BOT_DETECTED_ISSUES);
            Iterator<Cache.Entry<IssueKey, Issue>> iter = bst.iterator();
            try (BufferedWriter writer = new BufferedWriter(new FileWriter(new File(dumpsDir(),
                "Issues_dropped.txt")))) {
                while (iter.hasNext()) {
                    Cache.Entry<IssueKey, Issue> next = iter.next();

                    boolean rmv = false;
                    Issue val = next.getValue();
                    if (val.type == null)
                        rmv = true;

                    //don't touch it
                    if (Objects.equals(val.type, IssueType.newContributedTestFailure.code()))
                        continue;

                    long ageDays = -1;
                    if (val != null && val.buildStartTs == null) {
                        if (val.detectedTs == null)
                            rmv = true;
                        else
                            ageDays = Duration.ofMillis(System.currentTimeMillis() - val.detectedTs).toDays();


                        rmv = true;
                    }

                    if(rmv) {
                        bst.remove(next.getKey());

                        String str = "Removing issue " + next.getKey() + " " + val.type + " detected " +
                            ageDays + " days ago\n";
                        writer.write(str);
                        System.err.println(str);
                    }
                }

                writer.flush();
            }
            catch (IOException e) {
                throw new UncheckedIOException(e);
            }

            dumpDictionary(ignite);
        }
    }